Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suspicious assignment to a by-value method receiver (RowReceiverArr.BindAddress) #47396

Open
chavacava opened this issue Oct 4, 2023 · 0 comments
Labels
component/dumpling This is related to Dumpling of TiDB.

Comments

@chavacava
Copy link

func (r RowReceiverArr) BindAddress(args []interface{}) {
if r.bound {
return
}
r.bound = true
for i := range args {
r.receivers[i].BindAddress(args[i : i+1])
}
}

The assignment r.bound = true (line 204) has no effect out of the method body,
The receiver must be by-reference to keep the assigned value beyond the method call.
Either make the receiver by-reference or remove lines 201-204

(found by revive while testing it on tidb code base)

@lance6716 lance6716 added the component/dumpling This is related to Dumpling of TiDB. label Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/dumpling This is related to Dumpling of TiDB.
Projects
None yet
Development

No branches or pull requests

2 participants