aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/mod_get_main.txt
blob: 408a5b51c843f04f29ec537f28d0ac7187dbd3f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
env GO111MODULE=on
cp go.mod.orig go.mod

# relative and absolute paths must be within the main module.
! go get -d ..
stderr '^go get \.\.: path '$WORK'[/\\]gopath is not a package in module rooted at '$WORK'[/\\]gopath[/\\]src$'
! go get -d $WORK
stderr '^go get '$WORK': path '$WORK' is not a package in module rooted at '$WORK'[/\\]gopath[/\\]src$'
! go get -d ../...
stderr '^go get: pattern \.\./\.\.\.: directory prefix \.\. outside available modules$'
! go get -d $WORK/...
stderr '^go get: pattern '$WORK'[/\\]\.\.\.: directory prefix \.\.[/\\]\.\. outside available modules$'

# @patch and @latest within the main module refer to the current version.
# The main module won't be upgraded, but missing dependencies will be added.
go get -d rsc.io/x
grep 'rsc.io/quote v1.5.2' go.mod
go get -d rsc.io/x@upgrade
grep 'rsc.io/quote v1.5.2' go.mod
cp go.mod.orig go.mod
go get -d rsc.io/x@patch
grep 'rsc.io/quote v1.5.2' go.mod
cp go.mod.orig go.mod

# The main module cannot be updated to @latest, which is a specific version.
! go get -d rsc.io/x@latest
stderr '^go get rsc.io/x@latest: can.t request explicit version of path in main module$'

# The main module cannot be updated to a specific version.
! go get -d rsc.io/x@v0.1.0
stderr '^go get rsc.io/x@v0.1.0: can.t request explicit version of path in main module$'
! go get -d rsc.io/x@v0.1.0
stderr '^go get rsc.io/x@v0.1.0: can.t request explicit version of path in main module$'

# Upgrading a package pattern not contained in the main module should not
# attempt to upgrade the main module.
go get -d rsc.io/quote/...@v1.5.1
grep 'rsc.io/quote v1.5.1' go.mod

-- go.mod.orig --
module rsc.io

go 1.13
-- x/x.go --
package x

import _ "rsc.io/quote"