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: false positive on +build comment if within a string #24080

Closed
andybons opened this issue Feb 23, 2018 · 4 comments

Comments

Projects
None yet
4 participants
@andybons
Copy link
Member

commented Feb 23, 2018

go version go1.10 linux/amd64

When running go vet on the following code, it complains that the +build comment is in the wrong place:

package main

const prog = `
// +build foo
package main

func main() {}
`
@robpike

This comment has been minimized.

Copy link
Contributor

commented Feb 23, 2018

It's tricky and maybe hard to fix but I'll look into it.
The issue is that vet is looking for things in the wrong places, things the parser will toss, so it can't use the parser, yet without parsing the code it's easy to mislead the scanner.

@robpike robpike self-assigned this Feb 23, 2018

@andybons

This comment has been minimized.

Copy link
Member Author

commented Feb 23, 2018

Thanks, Rob.

@0xmohit

This comment has been minimized.

Copy link
Contributor

commented Feb 24, 2018

This was reported earlier here: #13533

@robpike

This comment has been minimized.

Copy link
Contributor

commented Feb 24, 2018

Duplicate of #13533.

That one was closed as too hard to fix for the payoff, which is fair. Closing.

@robpike robpike closed this Feb 24, 2018

@golang golang locked and limited conversation to collaborators Feb 24, 2019

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.