blob: 2a2fa42318aa1d10ceaef2d8725b868bd6013de6 [file] [log] [blame]
Colin Cross1f805522021-05-14 11:10:59 -07001# 'go mod download' can download specific versions of the main module.
2go mod download rsc.io/quote@5d9f230b
3go mod download rsc.io/quote@v1.5.2
4go 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.
8go mod download rsc.io/quote@upgrade
Dan Willemsenbc60c3c2021-12-15 01:09:00 -08009stderr '^go: skipping download of rsc.io/quote@upgrade that resolves to the main module$'
Colin Cross1f805522021-05-14 11:10:59 -070010go mod download rsc.io/quote@patch
Dan Willemsenbc60c3c2021-12-15 01:09:00 -080011stderr '^go: skipping download of rsc.io/quote@patch that resolves to the main module$'
Colin Cross1f805522021-05-14 11:10:59 -070012
13# 'go list -m' can show a version of the main module.
14go list -m rsc.io/quote@5d9f230b
15stdout '^rsc.io/quote v0.0.0-20180710144737-5d9f230bcfba$'
16go list -m rsc.io/quote@v1.5.2
17stdout '^rsc.io/quote v1.5.2$'
18go list -m rsc.io/quote@latest
19stdout '^rsc.io/quote v1.5.2$'
20
21# 'go list -m -versions' shows available versions.
22go list -m -versions rsc.io/quote
23stdout '^rsc.io/quote.*v1.5.2'
24
25# 'go list -m' resolves @upgrade and @patch to the main module.
26go list -m rsc.io/quote@upgrade
27stdout '^rsc.io/quote$'
28go list -m rsc.io/quote@patch
29stdout '^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
Dan Willemsenbc60c3c2021-12-15 01:09:00 -080034stderr '^go: can''t request version "5d9f230b" of the main module \(rsc.io/quote\)$'
Colin Cross1f805522021-05-14 11:10:59 -070035! go get rsc.io/quote@v1.5.2
Dan Willemsenbc60c3c2021-12-15 01:09:00 -080036stderr '^go: can''t request version "v1.5.2" of the main module \(rsc.io/quote\)$'
Colin Cross1f805522021-05-14 11:10:59 -070037! go get rsc.io/quote@latest
Dan Willemsenbc60c3c2021-12-15 01:09:00 -080038stderr '^go: can''t request version "latest" of the main module \(rsc.io/quote\)$'
Colin Cross1f805522021-05-14 11:10:59 -070039
40-- go.mod --
41module rsc.io/quote
42
43go 1.16