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

cmd/vet: confuses C name with import "C" #20655

Closed
mvdan opened this issue Jun 13, 2017 · 3 comments
Closed

cmd/vet: confuses C name with import "C" #20655

mvdan opened this issue Jun 13, 2017 · 3 comments
Milestone

Comments

@mvdan
Copy link
Member

mvdan commented Jun 13, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version devel +0e9d293db7 Sun Jun 11 04:25:26 2017 +0000 linux/amd64

Also on 1.8.3.

What operating system and processor architecture are you using (go env)?

Not relevant.

What did you do?

Run go vet on:

https://play.golang.org/p/uObdj6peim

What did you expect to see?

No vet errors related to passing pointers to C (I'm not even doing import "C")

What did you see instead?

$ go vet f.go
f.go:9: possibly passing Go type with embedded pointer to C
exit status 1

Note that this happens when the variable is named exactly C, and when we use a method on the type that has a pointer somewhere.

My intuition is that vet here does not check what C stands for. Since it seems like cmd/vet has type information, it should be fairly easy to figure out when C actually comes from import "C" and when it does not.

Happy to work on a patch if my thinking is correct.

@mvdan mvdan self-assigned this Jun 13, 2017
@mvdan
Copy link
Member Author

mvdan commented Jun 13, 2017

Looked at the code and this seems to be the case - only the ast.Ident is being used. CL incoming.

@gopherbot
Copy link

CL https://golang.org/cl/45551 mentions this issue.

@mvdan
Copy link
Member Author

mvdan commented Jun 14, 2017

As per golang.org/s/owners, CC @robpike @josharian

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants