-
Notifications
You must be signed in to change notification settings - Fork 17.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: convert module tests to scripts
Change-Id: If0976d15027db795f1383ef709c49c838cbb6953 Reviewed-on: https://go-review.googlesource.com/124696 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
- Loading branch information
Showing
9 changed files
with
205 additions
and
178 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
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,30 @@ | ||
# Test that build tags are used. | ||
# golang.org/issue/24053. | ||
|
||
env GO111MODULE=on | ||
|
||
cd x | ||
! go list -f {{.GoFiles}} | ||
stderr 'build constraints exclude all Go files' | ||
|
||
go list -f {{.GoFiles}} -tags tag1 | ||
stdout '\[x.go\]' | ||
|
||
go list -f {{.GoFiles}} -tags tag2 | ||
stdout '\[y\.go\]' | ||
|
||
go list -f {{.GoFiles}} -tags 'tag1 tag2' | ||
stdout '\[x\.go y\.go\]' | ||
|
||
-- x/go.mod -- | ||
module x | ||
|
||
-- x/x.go -- | ||
// +build tag1 | ||
|
||
package y | ||
|
||
-- x/y.go -- | ||
// +build tag2 | ||
|
||
package y |
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,67 @@ | ||
# GO111MODULE=auto should only trigger outside GOPATH/src | ||
env GO111MODULE=auto | ||
|
||
cd $GOPATH/src/x/y/z | ||
go env GOMOD | ||
! stdout . # no non-empty lines | ||
|
||
cd $GOPATH/src/x/y/z/w | ||
go env GOMOD | ||
! stdout . | ||
|
||
cd $GOPATH/src/x/y | ||
go env GOMOD | ||
! stdout . | ||
|
||
cd $GOPATH/foo | ||
go env GOMOD | ||
stdout foo[/\\]go.mod | ||
|
||
cd $GOPATH/foo/bar/baz | ||
go env GOMOD | ||
stdout foo[/\\]go.mod | ||
|
||
# GO111MODULE=on should trigger everywhere | ||
env GO111MODULE=on | ||
|
||
cd $GOPATH/src/x/y/z | ||
go env GOMOD | ||
stdout z[/\\]go.mod | ||
|
||
cd $GOPATH/src/x/y/z/w | ||
go env GOMOD | ||
stdout z[/\\]go.mod | ||
|
||
cd $GOPATH/src/x/y | ||
! go env GOMOD | ||
stderr 'cannot find main module root' | ||
|
||
cd $GOPATH/foo | ||
go env GOMOD | ||
stdout foo[/\\]go.mod | ||
|
||
cd $GOPATH/foo/bar/baz | ||
go env GOMOD | ||
stdout foo[/\\]go.mod | ||
|
||
# GO111MODULE=off should trigger nowhere | ||
env GO111MODULE=off | ||
|
||
cd $GOPATH/src/x/y/z | ||
go env GOMOD | ||
! stdout .+ | ||
|
||
cd $GOPATH/foo | ||
go env GOMOD | ||
! stdout .+ | ||
|
||
cd $GOPATH/foo/bar/baz | ||
go env GOMOD | ||
! stdout .+ | ||
|
||
-- $GOPATH/src/x/y/z/go.mod -- | ||
module x/y/z | ||
-- $GOPATH/src/x/y/z/w/w.txt -- | ||
-- $GOPATH/foo/go.mod -- | ||
module example.com/mod | ||
-- $GOPATH/foo/bar/baz/quux.txt -- |
Oops, something went wrong.