...
1env GO111MODULE=on
2
3# go.sum should list directly used modules and dependencies
4go get rsc.io/quote@v1.5.2
5go mod tidy
6grep rsc.io/sampler go.sum
7
8# go.sum should not normally lose old entries
9go get rsc.io/quote@v1.0.0
10grep 'rsc.io/quote v1.0.0' go.sum
11grep 'rsc.io/quote v1.5.2' go.sum
12grep rsc.io/sampler go.sum
13
14# go mod tidy should clear dead entries from go.sum
15go mod tidy
16grep 'rsc.io/quote v1.0.0' go.sum
17! grep 'rsc.io/quote v1.5.2' go.sum
18! grep rsc.io/sampler go.sum
19
20# go.sum with no entries is OK to keep
21# (better for version control not to delete and recreate.)
22cp x.go.noimports x.go
23go mod tidy
24exists go.sum
25! grep . go.sum
26
27-- go.mod --
28module x
29-- x.go --
30package x
31import _ "rsc.io/quote"
32-- x.go.noimports --
33package x
View as plain text