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

Comments

Projects
None yet
4 participants
@josharian
Copy link
Contributor

commented Oct 25, 2016

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

This comment has been minimized.

Copy link
Contributor

commented Oct 25, 2016

Also reported earlier.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Oct 25, 2016

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.
You can’t perform that action at this time.