1 # Test go get with the work pattern.
2
3 # go get work gets dependencies to satisfy missing imports in the
4 # main modules' package graph. Before the 'work' pattern existed, users
5 # would have to run './...' in the root of the work (main) module.
6 cp go.mod go.mod.orig
7 go get work
8 cmp go.mod go.mod.want
9
10 # 'go get work' and 'go get all' behave very differently. Because
11 # 'all' evaluates to work packages but also to their dependencies,
12 # 'go get all' will run the 'get' logic on all the dependency module
13 # packages, bumping all their modules to the latest versions.
14 cp go.mod.orig go.mod
15 go get all
16 cmp go.mod go.mod.all.want
17 -- go.mod --
18 module example.com/a
19
20 go 1.25
21 -- go.mod.want --
22 module example.com/a
23
24 go 1.25
25
26 require rsc.io/quote v1.5.2
27
28 require (
29 golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c // indirect
30 rsc.io/sampler v1.3.0 // indirect
31 )
32 -- go.mod.all.want --
33 module example.com/a
34
35 go 1.25
36
37 require rsc.io/quote v1.5.2
38
39 require (
40 golang.org/x/text v0.3.0 // indirect
41 rsc.io/sampler v1.99.99 // indirect
42 )
43 -- a.go --
44 package a
45
46 import _ "rsc.io/quote"
47
View as plain text