...
1env GO111MODULE=on
2[short] skip
3
4# Populate go.mod and go.sum.
5go mod tidy
6
7# initial conditions: using sampler v1.3.0, not listed in go.mod.
8go list -deps
9stdout rsc.io/sampler
10! grep 'rsc.io/sampler v1.3.0' go.mod
11
12# update to v1.3.1, now indirect in go.mod.
13go get rsc.io/sampler@v1.3.1
14grep 'rsc.io/sampler v1.3.1 // indirect' go.mod
15cp go.mod go.mod.good
16
17# vendoring can but should not need to make changes.
18go mod vendor
19cmp go.mod go.mod.good
20
21# go list -mod=vendor (or go build -mod=vendor) must not modify go.mod.
22# golang.org/issue/26704
23go list -mod=vendor
24cmp go.mod go.mod.good
25
26# With a clean (and empty) module cache, 'go list -mod=vendor' should not download modules.
27go clean -modcache
28env GOPROXY=off
29! go list ...
30go list -mod=vendor ...
31
32# However, it should still list packages in the main module.
33go list -mod=vendor m/...
34stdout m
35
36-- go.mod --
37module m
38go 1.12
39-- x.go --
40package x
41import _ "rsc.io/quote"
View as plain text