1 # Test that build tags are used.
2 # golang.org/issue/24053.
3
4 env GO111MODULE=on
5
6 cd x
7 ! go list -f {{.GoFiles}}
8 stderr 'build constraints exclude all Go files'
9
10 go list -f {{.GoFiles}} -tags tag1
11 stdout '\[x.go\]'
12
13 go list -f {{.GoFiles}} -tags tag2
14 stdout '\[y\.go\]'
15
16 go list -f {{.GoFiles}} -tags 'tag1 tag2'
17 stdout '\[x\.go y\.go\]'
18
19 go list -f {{.GoFiles}} -tags tag1,tag2 # commas allowed as of Go 1.13
20 stdout '\[x\.go y\.go\]'
21
22 -- x/go.mod --
23 module x
24
25 -- x/x.go --
26 // +build tag1
27
28 package y
29
30 -- x/y.go --
31 // +build tag2
32
33 package y
34
View as plain text