-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/vet: teach vet that putting a large value in an interface makes a copy #14529
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
Comments
This would have caught some bugs for us. |
cc @valyala :) |
It looks like this is already fixed in #14664 (go tip):
|
Other cases must be checked such as passing lock as function argument accepting |
Prepared a CL, which expands copylock check to function calls and return values - see https://go-review.googlesource.com/20832 . This catches passing lock into |
CL https://golang.org/cl/20832 mentions this issue. |
$ go vet x.go x.go:14: assignment copies lock value to s: main.T exit status 1
vet should also complain about the assignment
e = t
, since it also copies t's value.The text was updated successfully, but these errors were encountered: