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: should not warn +build in raw string literal #21716

Closed
cherrymui opened this issue Aug 31, 2017 · 5 comments
Closed

cmd/vet: should not warn +build in raw string literal #21716

cherrymui opened this issue Aug 31, 2017 · 5 comments

Comments

@cherrymui
Copy link
Member

After CL 60531 (https://go-review.googlesource.com/c/go/+/60531), the misc builder fails with

##### go vet std cmd
go run main.go -p freebsd/arm
go/types/hilbert_test.go:55: +build comment must appear before package clause and be followed by a blank line
exit status 1

(https://build.golang.org/log/890387a04a58201c9d1cf7d819dbe939e3e5d4b0)

The relevant line is https://go-review.googlesource.com/c/go/+/60531/2/src/go/types/hilbert_test.go#55
which is a +build in raw string literal.

@cznic
Copy link
Contributor

cznic commented Aug 31, 2017

I think this is intentional (ie. WAI), because some go tools are known to not parse the source when looking for [certain?] magic comments.

The solution is to, for example

s/+build/+`+`build/

or to use any other way of hiding the directive in it's plain form and starting at BOL.

@cherrymui
Copy link
Member Author

If this is the case we probably need to change go/types/hilbert_test.go to work around it. Kind of unfortunate.

@gopherbot
Copy link

Change https://golang.org/cl/60776 mentions this issue: go/types: escape +build sequence to silence vet warning

gopherbot pushed a commit that referenced this issue Aug 31, 2017
Appease the vet builder until we figure out the ideal solution.

Updates #21716.

Change-Id: I64ecdf9b6efb0933c5c79e11c860966ff1980305
Reviewed-on: https://go-review.googlesource.com/60776
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@mdempsky
Copy link
Member

We've worked around this issue in hilbert_test.go for now to appease the vet builder. If we decide to fix in cmd/vet instead, we should undo the workaround.

@robpike
Copy link
Contributor

robpike commented Sep 1, 2017

Working as intended.

@robpike robpike closed this as completed Sep 1, 2017
@golang golang locked and limited conversation to collaborators Sep 1, 2018
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

5 participants