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
Closed

cmd/vet: false positive on +build comment if within a string #24080

andybons opened this issue Feb 23, 2018 · 4 comments

Comments

@andybons
Copy link
Member

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
Copy link
Contributor

robpike 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
Copy link
Member Author

Thanks, Rob.

@0xmohit
Copy link
Contributor

0xmohit commented Feb 24, 2018

This was reported earlier here: #13533

@robpike
Copy link
Contributor

robpike 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 as completed Feb 24, 2018
@golang golang locked and limited conversation to collaborators Feb 24, 2019
@rsc rsc unassigned robpike Jun 23, 2022
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

4 participants