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: ignore build comments in string literals #17580

Closed
josharian opened this issue Oct 25, 2016 · 2 comments
Closed

cmd/vet: ignore build comments in string literals #17580

josharian opened this issue Oct 25, 2016 · 2 comments

Comments

@josharian
Copy link
Contributor

package p

const buildtag = `
// +build abc
`
$ go tool vet x.go
x.go:4: +build comment must appear before package clause and be followed by a blank line

This is a detectable false positive. This is very unlikely to be an actual attempt at a build comment; it's inside a string literal. This happens when writing code generators. There's a concrete instance in TestBinaryOnlyPackages in cmd/go/go_test.go.

cc @valyala @robpike

@0xmohit
Copy link
Contributor

0xmohit commented Oct 25, 2016

Also reported earlier.

@ianlancetaylor
Copy link
Contributor

Closing as dup of #13533.

@golang golang locked and limited conversation to collaborators Oct 25, 2017
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