| 1 |
env GO111MODULE=on |
| 2 |
cp go.mod.orig go.mod |
| 3 |
|
| 4 |
# relative and absolute paths must be within the main module. |
| 5 |
! go get .. |
| 6 |
stderr '^go: \.\. \('$WORK'[/\\]gopath\) is not within module rooted at '$WORK'[/\\]gopath[/\\]src$' |
| 7 |
! go get $WORK |
| 8 |
stderr '^go: '$WORK' is not within module rooted at '$WORK'[/\\]gopath[/\\]src$' |
| 9 |
! go get ../... |
| 10 |
stderr '^go: \.\./\.\.\. \('$WORK'[/\\]gopath([/\\]...)?\) is not within module rooted at '$WORK'[/\\]gopath[/\\]src$' |
| 11 |
! go get $WORK/... |
| 12 |
stderr '^go: '$WORK'[/\\]\.\.\. is not within module rooted at '$WORK'[/\\]gopath[/\\]src$' |
| 13 |
|
| 14 |
# @patch and @latest within the main module refer to the current version. |
| 15 |
# The main module won't be upgraded, but missing dependencies will be added. |
| 16 |
go get rsc.io/x |
| 17 |
grep 'rsc.io/quote v1.5.2' go.mod |
| 18 |
go get rsc.io/x@upgrade |
| 19 |
grep 'rsc.io/quote v1.5.2' go.mod |
| 20 |
cp go.mod.orig go.mod |
| 21 |
go get rsc.io/x@patch |
| 22 |
grep 'rsc.io/quote v1.5.2' go.mod |
| 23 |
cp go.mod.orig go.mod |
| 24 |
|
| 25 |
|
| 26 |
# Upgrading a package pattern not contained in the main module should not |
| 27 |
# attempt to upgrade the main module. |
| 28 |
go get rsc.io/quote/[email protected] |
| 29 |
grep 'rsc.io/quote v1.5.1' go.mod |
| 30 |
|
| 31 |
|
| 32 |
# The main module cannot be updated to a specific version. |
| 33 |
! go get [email protected] |
| 34 |
stderr '^go: can''t request version "v0.1.0" of the main module \(rsc.io\)$' |
| 35 |
|
| 36 |
# A package in the main module can't be upgraded either. |
| 37 |
! go get rsc.io/[email protected] |
| 38 |
stderr '^go: package rsc.io/x is in the main module, so can''t request version v0.1.0$' |
| 39 |
|
| 40 |
# Nor can a pattern matching packages in the main module. |
| 41 |
! go get rsc.io/x/...@latest |
| 42 |
stderr '^go: pattern rsc.io/x/... matches package rsc.io/x in the main module, so can''t request version latest$' |
| 43 |
|
| 44 |
-- go.mod.orig -- |
| 45 |
module rsc.io |
| 46 |
|
| 47 |
go 1.13 |
| 48 |
-- x/x.go -- |
| 49 |
package x |
| 50 |
|
| 51 |
import _ "rsc.io/quote" |