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: failing on files with build tags in raw string literals #24365

Closed
jayconrod opened this issue Mar 12, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@jayconrod
Copy link
Contributor

commented Mar 12, 2018

What version of Go are you using (go version)?

Go 1.10

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN="/usr/local/google/home/jayconrod/go/bin"
GOCACHE="/usr/local/google/home/jayconrod/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/usr/local/google/home/jayconrod/go"
GORACE=""
GOROOT="/usr/local/google/home/jayconrod/Code/go-1.10"
GOTMPDIR=""
GOTOOLDIR="/usr/local/google/home/jayconrod/Code/go-1.10/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build359663571=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ go get -u -d github.com/bazelbuild/bazel-gazelle
$ go test github.com/bazelbuild/bazel-gazelle/internal/packages

What did you expect to see?

No vet failures with the message +build comment must appear before package clause and be followed by a blank line.

What did you see instead?

Several failures with that message. In particular, see fileinfo_go_test.go:121.

Gazelle extracts some build metadata from source files. That includes build tags. There are some unit tests with raw literal strings that include build tags, and vet is reporting errors for these.

vet should ignore strings for the purposes of this check and should only report errors on comments.

@josharian

This comment has been minimized.

Copy link
Contributor

commented Mar 13, 2018

Duplicate of #13533

@josharian josharian marked this as a duplicate of #13533 Mar 13, 2018

@jayconrod

This comment has been minimized.

Copy link
Contributor Author

commented Mar 13, 2018

Thanks, I'll close this and comment on that issue.

@jayconrod jayconrod closed this Mar 13, 2018

@golang golang locked and limited conversation to collaborators Mar 13, 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.