-
Notifications
You must be signed in to change notification settings - Fork 17.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go has its own //go:build evaluator, which is needed for patterns like 'all'. The code is a modified copy of some unexported routines from the go/build package. Update it by copying those again and re-modifying them. The modifications are primarily the new func eval and also ignoring errors. This CL will need to be backported to Go 1.17, or else Go 1.17 will break when faced with certain //go:build-only repos during 'go list all' or 'go mod tidy'. For #41184. Fixes #49198. Change-Id: Ie0fe3caa8d49004935ecd76d7977f767fe50e317 Reviewed-on: https://go-review.googlesource.com/c/go/+/359355 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
- Loading branch information
Showing
2 changed files
with
192 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# go list all should work with GOOS=linux because all packages build on Linux | ||
env GOOS=linux | ||
go list all | ||
|
||
# go list all should work with GOOS=darwin, but it used to fail because | ||
# in the absence of //go:build support, p looked like it needed q | ||
# (p_test.go was not properly excluded), and q was Linux-only. | ||
# | ||
# Also testing with r and s that +build lines keep working. | ||
env GOOS=darwin | ||
go list all | ||
|
||
-- go.mod -- | ||
go 1.17 | ||
module m | ||
|
||
-- p/p.go -- | ||
package p | ||
|
||
-- p/p_test.go -- | ||
//go:build linux | ||
|
||
package p | ||
|
||
import "m/q" | ||
|
||
-- q/q_linux.go -- | ||
package q | ||
|
||
-- r/r.go -- | ||
package r | ||
|
||
-- r/r_test.go -- | ||
// +build linux | ||
|
||
package r | ||
|
||
import "m/s" | ||
|
||
-- s/s_linux.go -- | ||
package s |