aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/mod_build_tags.txt
blob: ae1d605e1f2f1227bbdea8c70c55f69941b6074f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 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\]'

go list -f {{.GoFiles}} -tags tag1,tag2 # commas allowed as of Go 1.13
stdout '\[x\.go y\.go\]'

-- x/go.mod --
module x

-- x/x.go --
// +build tag1

package y

-- x/y.go --
// +build tag2

package y