1 # 'go mod download' can download specific versions of the main module.
2 go mod download rsc.io/quote@5d9f230b
3 go mod download rsc.io/quote@v1.5.2
4 go mod download rsc.io/quote@latest
5
6 # 'go mod download' will not download @upgrade or @patch, since they always
7 # resolve to the main module.
8 go mod download rsc.io/quote@upgrade
9 stderr '^go: skipping download of rsc.io/quote@upgrade that resolves to the main module$'
10 go mod download rsc.io/quote@patch
11 stderr '^go: skipping download of rsc.io/quote@patch that resolves to the main module$'
12
13 # 'go list -m' can show a version of the main module.
14 go list -m rsc.io/quote@5d9f230b
15 stdout '^rsc.io/quote v0.0.0-20180710144737-5d9f230bcfba$'
16 go list -m rsc.io/quote@v1.5.2
17 stdout '^rsc.io/quote v1.5.2$'
18 go list -m rsc.io/quote@latest
19 stdout '^rsc.io/quote v1.5.2$'
20
21 # 'go list -m -versions' shows available versions.
22 go list -m -versions rsc.io/quote
23 stdout '^rsc.io/quote.*v1.5.2'
24
25 # 'go list -m' resolves @upgrade and @patch to the main module.
26 go list -m rsc.io/quote@upgrade
27 stdout '^rsc.io/quote$'
28 go list -m rsc.io/quote@patch
29 stdout '^rsc.io/quote$'
30
31 # 'go get' will not attempt to upgrade the main module to any specific version.
32 # See also: mod_get_main.txt.
33 ! go get rsc.io/quote@5d9f230b
34 stderr '^go: can''t request version "5d9f230b" of the main module \(rsc.io/quote\)$'
35 ! go get rsc.io/quote@v1.5.2
36 stderr '^go: can''t request version "v1.5.2" of the main module \(rsc.io/quote\)$'
37 ! go get rsc.io/quote@latest
38 stderr '^go: can''t request version "latest" of the main module \(rsc.io/quote\)$'
39
40 -- go.mod --
41 module rsc.io/quote
42
43 go 1.16
44
View as plain text