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

Comments

Projects
None yet
3 participants
@mvdan
Copy link
Member

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

This comment has been minimized.

Copy link
Member Author

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

This comment has been minimized.

Copy link

commented Jun 13, 2017

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

@mvdan

This comment has been minimized.

Copy link
Member Author

commented Jun 14, 2017

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

@josharian josharian added this to the Go1.10 milestone Jun 20, 2017

@gopherbot gopherbot closed this in bef0055 Aug 9, 2017

shivansh added a commit to shivansh/gocc that referenced this issue May 26, 2018

@golang golang locked and limited conversation to collaborators Aug 9, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.