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

x/tools/go/analysis/passes/buildtag: buildtag check triggers on multiline comment that mentions "+build" at start of line #42019

Closed
dmitshur opened this issue Oct 16, 2020 · 3 comments
Labels
Builders x/build issues (builders, bots, dashboards) FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@dmitshur
Copy link
Contributor

dmitshur commented Oct 16, 2020

gotip test golang.org/x/build/cmd/release failed before CL 263117 with:

$ gotip test   
# golang.org/x/build/cmd/release
./releaselet.go:609:1: +build comment must appear before package clause and be followed by a blank line

Because release had a multiline comment that mentioned "+build", and the lines happened to be split such that "+build" was at the start of a line:

// runSelfTests contains the tests for this file, since this file is
// +build ignore. This is called by releaselet_test.go with an
// environment variable set, which func main above recognizes.
func runSelfTests() {

I've fixed release by adjusting the comment to avoid beginning with "// +build" in CL 263117. CC @4a6f656c.

@rsc, is this a false-positive in vet that can/should also be fixed, or is it not a false-positive?

@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 16, 2020
@gopherbot gopherbot added the Builders x/build issues (builders, bots, dashboards) label Oct 16, 2020
@gopherbot gopherbot added this to the Unreleased milestone Oct 16, 2020
@gopherbot
Copy link

Change https://golang.org/cl/263117 mentions this issue: cmd/release: adjust comment to not begin with "// +build"

gopherbot pushed a commit to golang/build that referenced this issue Oct 16, 2020
For golang/go#42019.

Change-Id: I5c47bff63f02785ad6cf0ee547e53e503a600601
Reviewed-on: https://go-review.googlesource.com/c/build/+/263117
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
TryBot-Result: Go Bot <gobot@golang.org>
@dmitshur dmitshur changed the title x/build/cmd/release: // +build comment after package clause causes a vet error on tip x/tools/go/analysis/passes/buildtag: buildtag check triggers on multiline comment that mentions "+build" at start of line Oct 16, 2020
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Oct 16, 2020
@dmitshur
Copy link
Contributor Author

Now that x/build test failure is fixed, I've retitled to be about the buildtag check.

As far as I can tell, this is working as intended and this issue should be closed. But I'll let @rsc or @matloob confirm.

@rsc
Copy link
Contributor

rsc commented Oct 16, 2020

Working as intended: that might have been a real misplaced // +build line.

@rsc rsc closed this as completed Oct 16, 2020
@golang golang locked and limited conversation to collaborators Oct 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Builders x/build issues (builders, bots, dashboards) FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants