1 # test go get -tool
2 go get -tool example.com/tools/cmd/hello@v1.0.0
3 cmp go.mod go.mod.want
4
5 go get -u tool
6 cmp go.mod go.mod.upgraded
7
8 # test -tool with @none
9 go get -tool example.com/tools/cmd/hello@none
10 cmp go.mod go.mod.gone
11
12 go mod tidy
13 cmp go.mod go.mod.empty
14
15 # test -tool with wildcards
16 go get -tool ./cmd/...
17 cmp go.mod go.mod.wildcard
18 ! go get -tool ./cmd/...@none
19 stderr 'can''t request explicit version "none" of path "./cmd/..." in main module'
20
21 # test -tool with all
22 ! go get -tool all
23 stderr 'go get -tool does not work with "all"'
24
25 # test tool@none
26 ! go get tool@none
27 stderr 'can''t request explicit version of "tool" pattern'
28
29 -- main.go --
30 package main
31
32 func main() {}
33
34 -- go.mod --
35 module example.com/foo
36 go 1.24
37
38 -- go.mod.want --
39 module example.com/foo
40
41 go 1.24
42
43 tool example.com/tools/cmd/hello
44
45 require example.com/tools v1.0.0 // indirect
46 -- go.mod.upgraded --
47 module example.com/foo
48
49 go 1.24
50
51 tool example.com/tools/cmd/hello
52
53 require example.com/tools v1.1.0 // indirect
54 -- go.mod.gone --
55 module example.com/foo
56
57 go 1.24
58
59 require example.com/tools v1.1.0 // indirect
60 -- go.mod.empty --
61 module example.com/foo
62
63 go 1.24
64 -- go.mod.wildcard --
65 module example.com/foo
66
67 go 1.24
68
69 tool (
70 example.com/foo/cmd/a
71 example.com/foo/cmd/b
72 )
73 -- cmd/a/a.go --
74 package a
75
76 func main() {}
77
78 -- cmd/b/b.go --
79 package b
80
81 func main() {}
82
View as plain text