mirror of
https://github.com/golang/go
synced 2024-09-29 23:14:29 -06:00
cmd/go: update tests to work with -mod=readonly on by default
For #40728 Change-Id: Ic2b025ff75c6e73c0cb58c1737e44e2a41c71571 Reviewed-on: https://go-review.googlesource.com/c/go/+/253837 Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
parent
d277a36123
commit
03a6860691
@ -6,3 +6,5 @@ module example.com/retract/missingmod
|
|||||||
go 1.14
|
go 1.14
|
||||||
-- .info --
|
-- .info --
|
||||||
{"Version":"v1.0.0"}
|
{"Version":"v1.0.0"}
|
||||||
|
-- missingmod.go --
|
||||||
|
package missingmod
|
||||||
|
2
src/cmd/go/testdata/script/mod_auth.txt
vendored
2
src/cmd/go/testdata/script/mod_auth.txt
vendored
@ -7,7 +7,7 @@ env GOSUMDB=off
|
|||||||
# Without credentials, downloading a module from a path that requires HTTPS
|
# Without credentials, downloading a module from a path that requires HTTPS
|
||||||
# basic auth should fail.
|
# basic auth should fail.
|
||||||
env NETRC=$WORK/empty
|
env NETRC=$WORK/empty
|
||||||
! go list all
|
! go mod tidy
|
||||||
stderr '^\tserver response: ACCESS DENIED, buddy$'
|
stderr '^\tserver response: ACCESS DENIED, buddy$'
|
||||||
stderr '^\tserver response: File\? What file\?$'
|
stderr '^\tserver response: File\? What file\?$'
|
||||||
|
|
||||||
|
7
src/cmd/go/testdata/script/mod_case.txt
vendored
7
src/cmd/go/testdata/script/mod_case.txt
vendored
@ -1,6 +1,6 @@
|
|||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
|
|
||||||
go get rsc.io/QUOTE
|
go get -d
|
||||||
go list -m all
|
go list -m all
|
||||||
stdout '^rsc.io/quote v1.5.2'
|
stdout '^rsc.io/quote v1.5.2'
|
||||||
stdout '^rsc.io/QUOTE v1.5.2'
|
stdout '^rsc.io/QUOTE v1.5.2'
|
||||||
@ -18,3 +18,8 @@ stdout '!q!u!o!t!e@v1.5.3-!p!r!e'
|
|||||||
|
|
||||||
-- go.mod --
|
-- go.mod --
|
||||||
module x
|
module x
|
||||||
|
|
||||||
|
-- use.go --
|
||||||
|
package use
|
||||||
|
|
||||||
|
import _ "rsc.io/QUOTE/QUOTE"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
|
|
||||||
# Concurrent builds should succeed, even if they need to download modules.
|
# Concurrent builds should succeed, even if they need to download modules.
|
||||||
|
go get -d ./x ./y
|
||||||
go build ./x &
|
go build ./x &
|
||||||
go build ./y
|
go build ./y
|
||||||
wait
|
wait
|
||||||
|
2
src/cmd/go/testdata/script/mod_doc.txt
vendored
2
src/cmd/go/testdata/script/mod_doc.txt
vendored
@ -1,6 +1,7 @@
|
|||||||
# go doc should find module documentation
|
# go doc should find module documentation
|
||||||
|
|
||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
|
env GOFLAGS=-mod=mod
|
||||||
[short] skip
|
[short] skip
|
||||||
|
|
||||||
# Check when module x is inside GOPATH/src.
|
# Check when module x is inside GOPATH/src.
|
||||||
@ -48,6 +49,7 @@ stderr '^doc: cannot find module providing package example.com/hello: module loo
|
|||||||
# path used in source code, not to the absolute path relative to GOROOT.
|
# path used in source code, not to the absolute path relative to GOROOT.
|
||||||
|
|
||||||
cd $GOROOT/src
|
cd $GOROOT/src
|
||||||
|
env GOFLAGS=
|
||||||
go doc cryptobyte
|
go doc cryptobyte
|
||||||
stdout '// import "golang.org/x/crypto/cryptobyte"'
|
stdout '// import "golang.org/x/crypto/cryptobyte"'
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# (example.com not example.com/something)
|
# (example.com not example.com/something)
|
||||||
|
|
||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
go build
|
go get -d
|
||||||
|
|
||||||
-- go.mod --
|
-- go.mod --
|
||||||
module x
|
module x
|
||||||
|
2
src/cmd/go/testdata/script/mod_download.txt
vendored
2
src/cmd/go/testdata/script/mod_download.txt
vendored
@ -46,7 +46,7 @@ go mod edit -require rsc.io/quote@v1.5.3-pre1
|
|||||||
! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-pre1.zip
|
! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-pre1.zip
|
||||||
|
|
||||||
# module loading will page in the info and mod files
|
# module loading will page in the info and mod files
|
||||||
go list -m all
|
go list -m -mod=mod all
|
||||||
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-pre1.info
|
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-pre1.info
|
||||||
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-pre1.mod
|
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-pre1.mod
|
||||||
! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-pre1.zip
|
! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-pre1.zip
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Download a module
|
# Download modules and populate go.sum.
|
||||||
go mod download -modcacherw rsc.io/quote
|
go get -d -modcacherw
|
||||||
exists $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/go.mod
|
exists $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/go.mod
|
||||||
|
|
||||||
# 'go mod verify' should fail if we delete a file.
|
# 'go mod verify' should fail if we delete a file.
|
||||||
@ -61,4 +61,9 @@ go 1.14
|
|||||||
|
|
||||||
require rsc.io/quote v1.5.2
|
require rsc.io/quote v1.5.2
|
||||||
|
|
||||||
|
-- use.go --
|
||||||
|
package use
|
||||||
|
|
||||||
|
import _ "rsc.io/quote"
|
||||||
|
|
||||||
-- empty --
|
-- empty --
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
|
|
||||||
go list x
|
go get -d x
|
||||||
go list -m all
|
go list -m all
|
||||||
stdout 'rsc.io/breaker v2.0.0\+incompatible'
|
stdout 'rsc.io/breaker v2.0.0\+incompatible'
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ grep 'golang.org/x/text v0.3.0 // indirect$' go.mod
|
|||||||
|
|
||||||
# indirect tag should be removed upon seeing direct import.
|
# indirect tag should be removed upon seeing direct import.
|
||||||
cp $WORK/tmp/uselang.go x.go
|
cp $WORK/tmp/uselang.go x.go
|
||||||
go list
|
go get -d
|
||||||
grep 'rsc.io/quote v1.5.2$' go.mod
|
grep 'rsc.io/quote v1.5.2$' go.mod
|
||||||
grep 'golang.org/x/text [v0-9a-f\.-]+$' go.mod
|
grep 'golang.org/x/text [v0-9a-f\.-]+$' go.mod
|
||||||
|
|
||||||
|
@ -5,6 +5,6 @@
|
|||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
|
|
||||||
go mod init m
|
go mod init m
|
||||||
go list example.com/notags
|
go get -d example.com/notags
|
||||||
go list -m all
|
go list -m all
|
||||||
stdout '^example.com/notags v0.0.0-20190507143103-cc8cbe209b64$'
|
stdout '^example.com/notags v0.0.0-20190507143103-cc8cbe209b64$'
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
# Populate go.sum
|
||||||
|
go mod download
|
||||||
|
|
||||||
# go list should succeed to load a package ending with ".go" if the path does
|
# go list should succeed to load a package ending with ".go" if the path does
|
||||||
# not correspond to an existing local file. Listing a pattern ending with
|
# not correspond to an existing local file. Listing a pattern ending with
|
||||||
# ".go/" should try to list a package regardless of whether a file exists at the
|
# ".go/" should try to list a package regardless of whether a file exists at the
|
||||||
|
2
src/cmd/go/testdata/script/mod_import.txt
vendored
2
src/cmd/go/testdata/script/mod_import.txt
vendored
@ -1,7 +1,7 @@
|
|||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
|
|
||||||
# latest rsc.io/quote should be v1.5.2 not v1.5.3-pre1
|
# latest rsc.io/quote should be v1.5.2 not v1.5.3-pre1
|
||||||
go list
|
go get -d
|
||||||
go list -m all
|
go list -m all
|
||||||
stdout 'rsc.io/quote v1.5.2'
|
stdout 'rsc.io/quote v1.5.2'
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ env GO111MODULE=on
|
|||||||
cd $WORK/testdata
|
cd $WORK/testdata
|
||||||
go mod init testdata.tld/foo
|
go mod init testdata.tld/foo
|
||||||
|
|
||||||
# Building a package within that module should resolve its dependencies.
|
# Getting a package within that module should resolve its dependencies.
|
||||||
go build
|
go get -d
|
||||||
grep 'rsc.io/quote' go.mod
|
grep 'rsc.io/quote' go.mod
|
||||||
|
|
||||||
# Tidying the module should preserve those dependencies.
|
# Tidying the module should preserve those dependencies.
|
||||||
@ -26,7 +26,7 @@ exists vendor/rsc.io/quote
|
|||||||
cd $WORK/_ignored
|
cd $WORK/_ignored
|
||||||
go mod init testdata.tld/foo
|
go mod init testdata.tld/foo
|
||||||
|
|
||||||
go build
|
go get
|
||||||
grep 'rsc.io/quote' go.mod
|
grep 'rsc.io/quote' go.mod
|
||||||
|
|
||||||
go mod tidy
|
go mod tidy
|
||||||
|
21
src/cmd/go/testdata/script/mod_init_dep.txt
vendored
21
src/cmd/go/testdata/script/mod_init_dep.txt
vendored
@ -1,24 +1,14 @@
|
|||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
|
env GOFLAGS=-mod=mod
|
||||||
|
|
||||||
# modconv uses git directly to examine what old 'go get' would
|
# modconv uses git directly to examine what old 'go get' would
|
||||||
[!net] skip
|
[!net] skip
|
||||||
[!exec:git] skip
|
[!exec:git] skip
|
||||||
|
|
||||||
# go build should populate go.mod from Gopkg.lock
|
# go mod init should populate go.mod from Gopkg.lock
|
||||||
cp go.mod1 go.mod
|
go mod init x
|
||||||
go build
|
|
||||||
stderr 'copying requirements from Gopkg.lock'
|
stderr 'copying requirements from Gopkg.lock'
|
||||||
go list -m all
|
go list -m all
|
||||||
! stderr 'copying requirements from Gopkg.lock'
|
|
||||||
stdout 'rsc.io/sampler v1.0.0'
|
|
||||||
|
|
||||||
# go list should populate go.mod from Gopkg.lock
|
|
||||||
cp go.mod1 go.mod
|
|
||||||
go list
|
|
||||||
stderr 'copying requirements from Gopkg.lock'
|
|
||||||
go list
|
|
||||||
! stderr 'copying requirements from Gopkg.lock'
|
|
||||||
go list -m all
|
|
||||||
stdout 'rsc.io/sampler v1.0.0'
|
stdout 'rsc.io/sampler v1.0.0'
|
||||||
|
|
||||||
# test dep replacement
|
# test dep replacement
|
||||||
@ -26,9 +16,6 @@ cd y
|
|||||||
go mod init
|
go mod init
|
||||||
cmpenv go.mod go.mod.replace
|
cmpenv go.mod go.mod.replace
|
||||||
|
|
||||||
-- go.mod1 --
|
|
||||||
module x
|
|
||||||
|
|
||||||
-- x.go --
|
-- x.go --
|
||||||
package x
|
package x
|
||||||
|
|
||||||
@ -54,4 +41,4 @@ go $goversion
|
|||||||
|
|
||||||
replace z v1.0.0 => rsc.io/quote v1.0.0
|
replace z v1.0.0 => rsc.io/quote v1.0.0
|
||||||
|
|
||||||
require rsc.io/quote v1.0.0
|
require rsc.io/quote v1.0.0
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
|
|
||||||
|
go get -d rsc.io/fortune
|
||||||
go list -f '{{.Target}}' rsc.io/fortune
|
go list -f '{{.Target}}' rsc.io/fortune
|
||||||
! stdout fortune@v1
|
! stdout fortune@v1
|
||||||
stdout 'fortune(\.exe)?$'
|
stdout 'fortune(\.exe)?$'
|
||||||
|
|
||||||
|
go get -d rsc.io/fortune/v2
|
||||||
go list -f '{{.Target}}' rsc.io/fortune/v2
|
go list -f '{{.Target}}' rsc.io/fortune/v2
|
||||||
! stdout v2
|
! stdout v2
|
||||||
stdout 'fortune(\.exe)?$'
|
stdout 'fortune(\.exe)?$'
|
||||||
|
14
src/cmd/go/testdata/script/mod_internal.txt
vendored
14
src/cmd/go/testdata/script/mod_internal.txt
vendored
@ -3,30 +3,34 @@ env GO111MODULE=on
|
|||||||
|
|
||||||
# golang.org/x/internal should be importable from other golang.org/x modules.
|
# golang.org/x/internal should be importable from other golang.org/x modules.
|
||||||
go mod edit -module=golang.org/x/anything
|
go mod edit -module=golang.org/x/anything
|
||||||
go build .
|
go get -d .
|
||||||
|
|
||||||
# ...and their tests...
|
# ...and their tests...
|
||||||
go test
|
go test
|
||||||
stdout PASS
|
stdout PASS
|
||||||
|
|
||||||
# ...but that should not leak into other modules.
|
# ...but that should not leak into other modules.
|
||||||
|
go get -d ./baddep
|
||||||
! go build ./baddep
|
! go build ./baddep
|
||||||
stderr golang.org[/\\]notx[/\\]useinternal
|
stderr golang.org[/\\]notx[/\\]useinternal
|
||||||
stderr 'use of internal package golang.org/x/.* not allowed'
|
stderr 'use of internal package golang.org/x/.* not allowed'
|
||||||
|
|
||||||
# Internal packages in the standard library should not leak into modules.
|
# Internal packages in the standard library should not leak into modules.
|
||||||
|
go get -d ./fromstd
|
||||||
! go build ./fromstd
|
! go build ./fromstd
|
||||||
stderr 'use of internal package internal/testenv not allowed'
|
stderr 'use of internal package internal/testenv not allowed'
|
||||||
|
|
||||||
# Dependencies should be able to use their own internal modules...
|
# Dependencies should be able to use their own internal modules...
|
||||||
go mod edit -module=golang.org/notx
|
go mod edit -module=golang.org/notx
|
||||||
go build ./throughdep
|
go get -d ./throughdep
|
||||||
|
|
||||||
# ... but other modules should not, even if they have transitive dependencies.
|
# ... but other modules should not, even if they have transitive dependencies.
|
||||||
|
go get -d .
|
||||||
! go build .
|
! go build .
|
||||||
stderr 'use of internal package golang.org/x/.* not allowed'
|
stderr 'use of internal package golang.org/x/.* not allowed'
|
||||||
|
|
||||||
# And transitive dependencies still should not leak.
|
# And transitive dependencies still should not leak.
|
||||||
|
go get -d ./baddep
|
||||||
! go build ./baddep
|
! go build ./baddep
|
||||||
stderr golang.org[/\\]notx[/\\]useinternal
|
stderr golang.org[/\\]notx[/\\]useinternal
|
||||||
stderr 'use of internal package golang.org/x/.* not allowed'
|
stderr 'use of internal package golang.org/x/.* not allowed'
|
||||||
@ -34,15 +38,17 @@ stderr 'use of internal package golang.org/x/.* not allowed'
|
|||||||
# Replacing an internal module should keep it internal to the same paths.
|
# Replacing an internal module should keep it internal to the same paths.
|
||||||
go mod edit -module=golang.org/notx
|
go mod edit -module=golang.org/notx
|
||||||
go mod edit -replace golang.org/x/internal=./replace/golang.org/notx/internal
|
go mod edit -replace golang.org/x/internal=./replace/golang.org/notx/internal
|
||||||
go build ./throughdep
|
go get -d ./throughdep
|
||||||
|
|
||||||
|
go get -d ./baddep
|
||||||
! go build ./baddep
|
! go build ./baddep
|
||||||
stderr golang.org[/\\]notx[/\\]useinternal
|
stderr golang.org[/\\]notx[/\\]useinternal
|
||||||
stderr 'use of internal package golang.org/x/.* not allowed'
|
stderr 'use of internal package golang.org/x/.* not allowed'
|
||||||
|
|
||||||
go mod edit -replace golang.org/x/internal=./vendor/golang.org/x/internal
|
go mod edit -replace golang.org/x/internal=./vendor/golang.org/x/internal
|
||||||
go build ./throughdep
|
go get -d ./throughdep
|
||||||
|
|
||||||
|
go get -d ./baddep
|
||||||
! go build ./baddep
|
! go build ./baddep
|
||||||
stderr golang.org[/\\]notx[/\\]useinternal
|
stderr golang.org[/\\]notx[/\\]useinternal
|
||||||
stderr 'use of internal package golang.org/x/.* not allowed'
|
stderr 'use of internal package golang.org/x/.* not allowed'
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
env GOPROXY=direct
|
env GOPROXY=direct
|
||||||
env GOSUMDB=off
|
env GOSUMDB=off
|
||||||
|
env GOFLAGS=-mod=mod
|
||||||
|
|
||||||
# Regression test for golang.org/issue/27173: if the user (or go.mod file)
|
# Regression test for golang.org/issue/27173: if the user (or go.mod file)
|
||||||
# requests a pseudo-version that does not match both the module path and commit
|
# requests a pseudo-version that does not match both the module path and commit
|
||||||
|
8
src/cmd/go/testdata/script/mod_list.txt
vendored
8
src/cmd/go/testdata/script/mod_list.txt
vendored
@ -2,12 +2,12 @@ env GO111MODULE=on
|
|||||||
[short] skip
|
[short] skip
|
||||||
|
|
||||||
# list {{.Dir}} shows main module and go.mod but not not-yet-downloaded dependency dir.
|
# list {{.Dir}} shows main module and go.mod but not not-yet-downloaded dependency dir.
|
||||||
go list -m -f '{{.Path}} {{.Main}} {{.GoMod}} {{.Dir}}' all
|
go list -mod=mod -m -f '{{.Path}} {{.Main}} {{.GoMod}} {{.Dir}}' all
|
||||||
stdout '^x true .*[\\/]src[\\/]go.mod .*[\\/]src$'
|
stdout '^x true .*[\\/]src[\\/]go.mod .*[\\/]src$'
|
||||||
stdout '^rsc.io/quote false .*[\\/]v1.5.2.mod $'
|
stdout '^rsc.io/quote false .*[\\/]v1.5.2.mod $'
|
||||||
|
|
||||||
# list {{.Dir}} shows dependency after download (and go list without -m downloads it)
|
# list {{.Dir}} shows dependency after download (and go list without -m downloads it)
|
||||||
go list -f '{{.Dir}}' rsc.io/quote
|
go list -mod=mod -f '{{.Dir}}' rsc.io/quote
|
||||||
stdout '.*mod[\\/]rsc.io[\\/]quote@v1.5.2$'
|
stdout '.*mod[\\/]rsc.io[\\/]quote@v1.5.2$'
|
||||||
|
|
||||||
# downloaded dependencies are read-only
|
# downloaded dependencies are read-only
|
||||||
@ -20,7 +20,7 @@ go clean -modcache
|
|||||||
|
|
||||||
# list {{.Dir}} shows replaced directories
|
# list {{.Dir}} shows replaced directories
|
||||||
cp go.mod2 go.mod
|
cp go.mod2 go.mod
|
||||||
go list -f {{.Dir}} rsc.io/quote
|
go list -mod=mod -f {{.Dir}} rsc.io/quote
|
||||||
go list -m -f '{{.Path}} {{.Version}} {{.Dir}}{{with .Replace}} {{.GoMod}} => {{.Version}} {{.Dir}} {{.GoMod}}{{end}}' all
|
go list -m -f '{{.Path}} {{.Version}} {{.Dir}}{{with .Replace}} {{.GoMod}} => {{.Version}} {{.Dir}} {{.GoMod}}{{end}}' all
|
||||||
stdout 'mod[\\/]rsc.io[\\/]quote@v1.5.1'
|
stdout 'mod[\\/]rsc.io[\\/]quote@v1.5.1'
|
||||||
stdout 'v1.3.0.*mod[\\/]rsc.io[\\/]sampler@v1.3.1 .*[\\/]v1.3.1.mod => v1.3.1.*sampler@v1.3.1 .*[\\/]v1.3.1.mod'
|
stdout 'v1.3.0.*mod[\\/]rsc.io[\\/]sampler@v1.3.1 .*[\\/]v1.3.1.mod => v1.3.1.*sampler@v1.3.1 .*[\\/]v1.3.1.mod'
|
||||||
@ -30,7 +30,7 @@ go list std
|
|||||||
stdout ^math/big
|
stdout ^math/big
|
||||||
|
|
||||||
# rsc.io/quote/buggy should be listable as a package
|
# rsc.io/quote/buggy should be listable as a package
|
||||||
go list rsc.io/quote/buggy
|
go list -mod=mod rsc.io/quote/buggy
|
||||||
|
|
||||||
# rsc.io/quote/buggy should not be listable as a module
|
# rsc.io/quote/buggy should not be listable as a module
|
||||||
go list -m -e -f '{{.Error.Err}}' nonexist rsc.io/quote/buggy
|
go list -m -e -f '{{.Error.Err}}' nonexist rsc.io/quote/buggy
|
||||||
|
5
src/cmd/go/testdata/script/mod_list_dir.txt
vendored
5
src/cmd/go/testdata/script/mod_list_dir.txt
vendored
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
# go list with path to directory should work
|
# go list with path to directory should work
|
||||||
|
|
||||||
|
# populate go.sum
|
||||||
|
go get -d
|
||||||
|
|
||||||
env GO111MODULE=off
|
env GO111MODULE=off
|
||||||
go list -f '{{.ImportPath}}' $GOROOT/src/math
|
go list -f '{{.ImportPath}}' $GOROOT/src/math
|
||||||
stdout ^math$
|
stdout ^math$
|
||||||
@ -29,3 +32,5 @@ require rsc.io/quote v1.5.2
|
|||||||
|
|
||||||
-- x.go --
|
-- x.go --
|
||||||
package x
|
package x
|
||||||
|
|
||||||
|
import _ "rsc.io/quote"
|
||||||
|
@ -10,7 +10,7 @@ env GOSUMDB=off
|
|||||||
# For a while, (*modfetch.codeRepo).Stat was not checking for a go.mod file,
|
# For a while, (*modfetch.codeRepo).Stat was not checking for a go.mod file,
|
||||||
# which would produce a hard error at the subsequent call to GoMod.
|
# which would produce a hard error at the subsequent call to GoMod.
|
||||||
|
|
||||||
go list all
|
go get -d
|
||||||
|
|
||||||
-- go.mod --
|
-- go.mod --
|
||||||
module example.com
|
module example.com
|
||||||
|
@ -2,8 +2,11 @@
|
|||||||
# module within the module cache.
|
# module within the module cache.
|
||||||
# Verifies golang.org/issue/29548
|
# Verifies golang.org/issue/29548
|
||||||
|
|
||||||
env GO111MODULE=on
|
# Populate go.sum and download dependencies.
|
||||||
go mod download rsc.io/quote@v1.5.1 rsc.io/quote@v1.5.2
|
go get -d
|
||||||
|
|
||||||
|
# Ensure v1.5.2 is also in the cache so we can list it.
|
||||||
|
go mod download rsc.io/quote@v1.5.2
|
||||||
|
|
||||||
! go list $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
|
! go list $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
|
||||||
stderr '^directory ..[/\\]pkg[/\\]mod[/\\]rsc.io[/\\]quote@v1.5.2 outside available modules$'
|
stderr '^directory ..[/\\]pkg[/\\]mod[/\\]rsc.io[/\\]quote@v1.5.2 outside available modules$'
|
||||||
@ -17,3 +20,8 @@ module example.com/quoter
|
|||||||
require rsc.io/quote v1.5.2
|
require rsc.io/quote v1.5.2
|
||||||
|
|
||||||
replace rsc.io/quote => rsc.io/quote v1.5.1
|
replace rsc.io/quote => rsc.io/quote v1.5.1
|
||||||
|
|
||||||
|
-- use.go --
|
||||||
|
package use
|
||||||
|
|
||||||
|
import _ "rsc.io/quote"
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
|
|
||||||
|
# Populate go.sum
|
||||||
|
go list -m -mod=mod all
|
||||||
|
|
||||||
|
# Check for upgrades.
|
||||||
go list -m -u all
|
go list -m -u all
|
||||||
stdout 'rsc.io/quote v1.2.0 \[v1\.5\.2\]'
|
stdout 'rsc.io/quote v1.2.0 \[v1\.5\.2\]'
|
||||||
|
|
||||||
|
@ -28,10 +28,10 @@ cmp stderr list-expected
|
|||||||
# Try listing a package that imports a package
|
# Try listing a package that imports a package
|
||||||
# in a module without a requirement.
|
# in a module without a requirement.
|
||||||
go mod edit -droprequire example.com/badchain/a
|
go mod edit -droprequire example.com/badchain/a
|
||||||
! go list m/use
|
! go list -mod=mod m/use
|
||||||
cmp stderr list-missing-expected
|
cmp stderr list-missing-expected
|
||||||
|
|
||||||
! go list -test m/testuse
|
! go list -mod=mod -test m/testuse
|
||||||
cmp stderr list-missing-test-expected
|
cmp stderr list-missing-test-expected
|
||||||
|
|
||||||
-- go.mod.orig --
|
-- go.mod.orig --
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
# Unknown lines should be ignored in dependency go.mod files.
|
# Unknown lines should be ignored in dependency go.mod files.
|
||||||
env GO111MODULE=on
|
go list -m -mod=mod all
|
||||||
go list -m all
|
|
||||||
|
|
||||||
# ... and in replaced dependency go.mod files.
|
# ... and in replaced dependency go.mod files.
|
||||||
cp go.mod go.mod.usesub
|
cp go.mod go.mod.usesub
|
||||||
go list -m all
|
go list -m -mod=mod all
|
||||||
|
|
||||||
# ... but not in the main module.
|
# ... but not in the main module.
|
||||||
cp go.mod.bad go.mod
|
cp go.mod.bad go.mod
|
||||||
! go list -m all
|
! go list -m -mod=mod all
|
||||||
stderr 'unknown directive: hello'
|
stderr 'unknown directive: hello'
|
||||||
|
|
||||||
-- go.mod --
|
-- go.mod --
|
||||||
|
@ -5,10 +5,8 @@ env GO111MODULE=on
|
|||||||
stderr 'zip for rsc.io/badzip@v1.0.0 has unexpected file rsc.io/badzip@v1.0.0.txt'
|
stderr 'zip for rsc.io/badzip@v1.0.0 has unexpected file rsc.io/badzip@v1.0.0.txt'
|
||||||
! grep rsc.io/badzip go.mod
|
! grep rsc.io/badzip go.mod
|
||||||
|
|
||||||
# TODO(golang.org/issue/31730): 'go build' should print the error below if the
|
|
||||||
# requirement is not present.
|
|
||||||
go mod edit -require rsc.io/badzip@v1.0.0
|
go mod edit -require rsc.io/badzip@v1.0.0
|
||||||
! go build rsc.io/badzip
|
! go build -mod=mod rsc.io/badzip
|
||||||
stderr 'zip for rsc.io/badzip@v1.0.0 has unexpected file rsc.io/badzip@v1.0.0.txt'
|
stderr 'zip for rsc.io/badzip@v1.0.0 has unexpected file rsc.io/badzip@v1.0.0.txt'
|
||||||
|
|
||||||
-- go.mod --
|
-- go.mod --
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
|
|
||||||
! go list -deps use.go
|
! go list -mod=mod -deps use.go
|
||||||
stderr '^use.go:4:2: package example.com/missingpkg/deprecated provided by example.com/missingpkg at latest version v1.0.0 but not at required version v1.0.1-beta$'
|
stderr '^use.go:4:2: package example.com/missingpkg/deprecated provided by example.com/missingpkg at latest version v1.0.0 but not at required version v1.0.1-beta$'
|
||||||
|
|
||||||
-- go.mod --
|
-- go.mod --
|
||||||
|
1
src/cmd/go/testdata/script/mod_modinfo.txt
vendored
1
src/cmd/go/testdata/script/mod_modinfo.txt
vendored
@ -6,6 +6,7 @@ env GO111MODULE=on
|
|||||||
cd x
|
cd x
|
||||||
go mod edit -require=rsc.io/quote@v1.5.2
|
go mod edit -require=rsc.io/quote@v1.5.2
|
||||||
go mod edit -replace=rsc.io/quote@v1.5.2=rsc.io/quote@v1.0.0
|
go mod edit -replace=rsc.io/quote@v1.5.2=rsc.io/quote@v1.0.0
|
||||||
|
go mod tidy # populate go.sum
|
||||||
|
|
||||||
# Build a binary and ensure that it can output its own debug info.
|
# Build a binary and ensure that it can output its own debug info.
|
||||||
# The debug info should be accessible before main starts (golang.org/issue/29628).
|
# The debug info should be accessible before main starts (golang.org/issue/29628).
|
||||||
|
1
src/cmd/go/testdata/script/mod_multirepo.txt
vendored
1
src/cmd/go/testdata/script/mod_multirepo.txt
vendored
@ -7,6 +7,7 @@ go list -deps -f {{.Dir}}
|
|||||||
# v2 import should use a downloaded module
|
# v2 import should use a downloaded module
|
||||||
# both without an explicit go.mod entry ...
|
# both without an explicit go.mod entry ...
|
||||||
cp tmp/use_v2.go x.go
|
cp tmp/use_v2.go x.go
|
||||||
|
go get -d .
|
||||||
go list -deps -f {{.Dir}}
|
go list -deps -f {{.Dir}}
|
||||||
stdout 'pkg[\\/]mod[\\/]rsc.io[\\/]quote[\\/]v2@v2.0.1$'
|
stdout 'pkg[\\/]mod[\\/]rsc.io[\\/]quote[\\/]v2@v2.0.1$'
|
||||||
|
|
||||||
|
1
src/cmd/go/testdata/script/mod_notall.txt
vendored
1
src/cmd/go/testdata/script/mod_notall.txt
vendored
@ -5,6 +5,7 @@
|
|||||||
# module, but not should not include test dependencies of packages imported only
|
# module, but not should not include test dependencies of packages imported only
|
||||||
# by other root patterns.
|
# by other root patterns.
|
||||||
|
|
||||||
|
env GOFLAGS=-mod=mod
|
||||||
cp go.mod go.mod.orig
|
cp go.mod go.mod.orig
|
||||||
|
|
||||||
go list -deps all x/otherroot
|
go list -deps all x/otherroot
|
||||||
|
@ -12,7 +12,7 @@ chmod 0640 go.mod
|
|||||||
chmod 0604 go.sum
|
chmod 0604 go.sum
|
||||||
go mod edit -module=golang.org/issue/34634
|
go mod edit -module=golang.org/issue/34634
|
||||||
|
|
||||||
go build .
|
go get -d
|
||||||
cmp go.mod go.mod.want
|
cmp go.mod go.mod.want
|
||||||
cmp go.sum go.sum.want
|
cmp go.sum go.sum.want
|
||||||
|
|
||||||
|
10
src/cmd/go/testdata/script/mod_query.txt
vendored
10
src/cmd/go/testdata/script/mod_query.txt
vendored
@ -1,5 +1,10 @@
|
|||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
|
|
||||||
|
# Populate go.sum.
|
||||||
|
# TODO(golang.org/issue/41297): we shouldn't need go.sum. None of the commands
|
||||||
|
# below depend on the build list.
|
||||||
|
go mod download
|
||||||
|
|
||||||
go list -m -versions rsc.io/quote
|
go list -m -versions rsc.io/quote
|
||||||
stdout '^rsc.io/quote v1.0.0 v1.1.0 v1.2.0 v1.2.1 v1.3.0 v1.4.0 v1.5.0 v1.5.1 v1.5.2 v1.5.3-pre1$'
|
stdout '^rsc.io/quote v1.0.0 v1.1.0 v1.2.0 v1.2.1 v1.3.0 v1.4.0 v1.5.0 v1.5.1 v1.5.2 v1.5.3-pre1$'
|
||||||
|
|
||||||
@ -30,3 +35,8 @@ stdout 'no matching versions for query ">v1.5.3"'
|
|||||||
-- go.mod --
|
-- go.mod --
|
||||||
module x
|
module x
|
||||||
require rsc.io/quote v1.0.0
|
require rsc.io/quote v1.0.0
|
||||||
|
|
||||||
|
-- use.go --
|
||||||
|
package use
|
||||||
|
|
||||||
|
import _ "rsc.io/quote"
|
||||||
|
4
src/cmd/go/testdata/script/mod_replace.txt
vendored
4
src/cmd/go/testdata/script/mod_replace.txt
vendored
@ -4,7 +4,7 @@ env GO111MODULE=on
|
|||||||
cp go.mod go.mod.orig
|
cp go.mod go.mod.orig
|
||||||
|
|
||||||
# Make sure the test builds without replacement.
|
# Make sure the test builds without replacement.
|
||||||
go build -o a1.exe .
|
go build -mod=mod -o a1.exe .
|
||||||
exec ./a1.exe
|
exec ./a1.exe
|
||||||
stdout 'Don''t communicate by sharing memory'
|
stdout 'Don''t communicate by sharing memory'
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ stderr 'rsc.io/quote/v3@v3.0.0 used for two different module paths \(not-rsc.io/
|
|||||||
# Modules that do not (yet) exist upstream can be replaced too.
|
# Modules that do not (yet) exist upstream can be replaced too.
|
||||||
cp go.mod.orig go.mod
|
cp go.mod.orig go.mod
|
||||||
go mod edit -replace=not-rsc.io/quote/v3@v3.1.0=./local/rsc.io/quote/v3
|
go mod edit -replace=not-rsc.io/quote/v3@v3.1.0=./local/rsc.io/quote/v3
|
||||||
go build -o a5.exe ./usenewmodule
|
go build -mod=mod -o a5.exe ./usenewmodule
|
||||||
! stderr 'finding not-rsc.io/quote/v3'
|
! stderr 'finding not-rsc.io/quote/v3'
|
||||||
grep 'not-rsc.io/quote/v3 v3.1.0' go.mod
|
grep 'not-rsc.io/quote/v3 v3.1.0' go.mod
|
||||||
exec ./a5.exe
|
exec ./a5.exe
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
env GOPROXY=direct
|
env GOPROXY=direct
|
||||||
env GOSUMDB=off
|
env GOSUMDB=off
|
||||||
|
env GOFLAGS=-mod=mod
|
||||||
|
|
||||||
# Replacing gopkg.in/[…].vN with a repository with a root go.mod file
|
# Replacing gopkg.in/[…].vN with a repository with a root go.mod file
|
||||||
# specifying […].vN and a compatible version should succeed, even if
|
# specifying […].vN and a compatible version should succeed, even if
|
||||||
|
@ -7,6 +7,7 @@ cp go.mod go.mod.orig
|
|||||||
cmp go.mod go.mod.orig
|
cmp go.mod go.mod.orig
|
||||||
|
|
||||||
# 'go list' should resolve imports using replacements.
|
# 'go list' should resolve imports using replacements.
|
||||||
|
go get -d
|
||||||
go list all
|
go list all
|
||||||
stdout 'example.com/a/b$'
|
stdout 'example.com/a/b$'
|
||||||
stdout 'example.com/x/v3$'
|
stdout 'example.com/x/v3$'
|
||||||
|
@ -20,7 +20,7 @@ cmp go.mod go.mod.orig
|
|||||||
# With the selected version excluded, commands that load only modules should
|
# With the selected version excluded, commands that load only modules should
|
||||||
# drop the excluded module.
|
# drop the excluded module.
|
||||||
|
|
||||||
go list -m all
|
go list -m -mod=mod all
|
||||||
stderr '^go: dropping requirement on excluded version rsc.io/sampler v1\.99\.99$'
|
stderr '^go: dropping requirement on excluded version rsc.io/sampler v1\.99\.99$'
|
||||||
stdout '^x$'
|
stdout '^x$'
|
||||||
! stdout '^rsc.io/sampler'
|
! stdout '^rsc.io/sampler'
|
||||||
@ -30,7 +30,7 @@ cmp go.mod go.moddrop
|
|||||||
# from the next-highest version.
|
# from the next-highest version.
|
||||||
|
|
||||||
cp go.mod.orig go.mod
|
cp go.mod.orig go.mod
|
||||||
go list -f '{{with .Module}}{{.Path}} {{.Version}}{{end}}' all
|
go list -mod=mod -f '{{with .Module}}{{.Path}} {{.Version}}{{end}}' all
|
||||||
stderr '^go: dropping requirement on excluded version rsc.io/sampler v1\.99\.99$'
|
stderr '^go: dropping requirement on excluded version rsc.io/sampler v1\.99\.99$'
|
||||||
stdout '^x $'
|
stdout '^x $'
|
||||||
! stdout '^rsc.io/sampler v1.99.99'
|
! stdout '^rsc.io/sampler v1.99.99'
|
||||||
@ -38,13 +38,13 @@ stdout '^rsc.io/sampler v1.3.0'
|
|||||||
|
|
||||||
# build with newer version available
|
# build with newer version available
|
||||||
cp go.mod2 go.mod
|
cp go.mod2 go.mod
|
||||||
go list -f '{{with .Module}}{{.Path}} {{.Version}}{{end}}' all
|
go list -mod=mod -f '{{with .Module}}{{.Path}} {{.Version}}{{end}}' all
|
||||||
stderr '^go: dropping requirement on excluded version rsc.io/quote v1\.5\.1$'
|
stderr '^go: dropping requirement on excluded version rsc.io/quote v1\.5\.1$'
|
||||||
stdout 'rsc.io/quote v1.5.2'
|
stdout 'rsc.io/quote v1.5.2'
|
||||||
|
|
||||||
# build with excluded newer version
|
# build with excluded newer version
|
||||||
cp go.mod3 go.mod
|
cp go.mod3 go.mod
|
||||||
go list -f '{{with .Module}}{{.Path}} {{.Version}}{{end}}' all
|
go list -mod=mod -f '{{with .Module}}{{.Path}} {{.Version}}{{end}}' all
|
||||||
! stderr '^go: dropping requirement'
|
! stderr '^go: dropping requirement'
|
||||||
stdout 'rsc.io/quote v1.5.1'
|
stdout 'rsc.io/quote v1.5.1'
|
||||||
|
|
||||||
|
6
src/cmd/go/testdata/script/mod_retention.txt
vendored
6
src/cmd/go/testdata/script/mod_retention.txt
vendored
@ -7,7 +7,7 @@ env GO111MODULE=on
|
|||||||
|
|
||||||
# Control case: verify that go.mod.tidy is actually tidy.
|
# Control case: verify that go.mod.tidy is actually tidy.
|
||||||
cp go.mod.tidy go.mod
|
cp go.mod.tidy go.mod
|
||||||
go list all
|
go list -mod=mod all
|
||||||
cmp go.mod go.mod.tidy
|
cmp go.mod go.mod.tidy
|
||||||
|
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ cmp go.mod go.mod.tidy
|
|||||||
# "// indirect" comments should be removed if direct dependencies are seen.
|
# "// indirect" comments should be removed if direct dependencies are seen.
|
||||||
# changes.
|
# changes.
|
||||||
cp go.mod.indirect go.mod
|
cp go.mod.indirect go.mod
|
||||||
go list all
|
go list -mod=mod all
|
||||||
cmp go.mod go.mod.tidy
|
cmp go.mod go.mod.tidy
|
||||||
|
|
||||||
# "// indirect" comments should be added if appropriate.
|
# "// indirect" comments should be added if appropriate.
|
||||||
@ -63,7 +63,7 @@ cmp go.mod go.mod.tidy
|
|||||||
# A missing "go" version directive should be added.
|
# A missing "go" version directive should be added.
|
||||||
# However, that should not remove other redundant requirements.
|
# However, that should not remove other redundant requirements.
|
||||||
cp go.mod.nogo go.mod
|
cp go.mod.nogo go.mod
|
||||||
go list all
|
go list -mod=mod all
|
||||||
cmpenv go.mod go.mod.currentgo
|
cmpenv go.mod go.mod.currentgo
|
||||||
|
|
||||||
|
|
||||||
|
5
src/cmd/go/testdata/script/mod_retract.txt
vendored
5
src/cmd/go/testdata/script/mod_retract.txt
vendored
@ -1,5 +1,8 @@
|
|||||||
cp go.mod go.mod.orig
|
cp go.mod go.mod.orig
|
||||||
|
|
||||||
|
# Populate go.sum.
|
||||||
|
go mod download
|
||||||
|
|
||||||
# 'go list pkg' does not report an error when a retracted version is used.
|
# 'go list pkg' does not report an error when a retracted version is used.
|
||||||
go list -e -f '{{if .Error}}{{.Error}}{{end}}' ./use
|
go list -e -f '{{if .Error}}{{.Error}}{{end}}' ./use
|
||||||
! stdout .
|
! stdout .
|
||||||
@ -17,7 +20,7 @@ exists $GOPATH/pkg/mod/cache/download/example.com/retract/@v/v1.0.0-bad.mod
|
|||||||
|
|
||||||
# Importing a package from a module with a retracted latest version will
|
# Importing a package from a module with a retracted latest version will
|
||||||
# select the latest non-retracted version.
|
# select the latest non-retracted version.
|
||||||
go list ./use_self_prev
|
go get -d ./use_self_prev
|
||||||
go list -m example.com/retract/self/prev
|
go list -m example.com/retract/self/prev
|
||||||
stdout '^example.com/retract/self/prev v1.1.0$'
|
stdout '^example.com/retract/self/prev v1.1.0$'
|
||||||
exists $GOPATH/pkg/mod/cache/download/example.com/retract/self/prev/@v/v1.9.0.mod
|
exists $GOPATH/pkg/mod/cache/download/example.com/retract/self/prev/@v/v1.9.0.mod
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
# If the latest unretracted version of a module is replaced, 'go list' should
|
# If the latest unretracted version of a module is replaced, 'go list' should
|
||||||
# obtain retractions from the replacement.
|
# obtain retractions from the replacement.
|
||||||
|
|
||||||
|
# Populate go.sum.
|
||||||
|
go get -d
|
||||||
|
|
||||||
# The latest version, v1.9.0, is not available on the proxy.
|
# The latest version, v1.9.0, is not available on the proxy.
|
||||||
! go list -m -retracted example.com/retract/missingmod
|
! go list -m -retracted example.com/retract/missingmod
|
||||||
stderr '^go list -m: loading module retractions: example.com/retract/missingmod@v1.9.0:.*404 Not Found$'
|
stderr '^go list -m: loading module retractions: example.com/retract/missingmod@v1.9.0:.*404 Not Found$'
|
||||||
@ -24,9 +27,9 @@ go list -m -retracted -f '{{range .Retracted}}{{.}}{{end}}' example.com/retract
|
|||||||
go list -m -retracted -f '{{if .Replace}}replaced{{end}}' example.com/retract
|
go list -m -retracted -f '{{if .Replace}}replaced{{end}}' example.com/retract
|
||||||
! stdout .
|
! stdout .
|
||||||
go mod edit -replace example.com/retract@v1.0.0-good=example.com/retract@v1.0.0-bad
|
go mod edit -replace example.com/retract@v1.0.0-good=example.com/retract@v1.0.0-bad
|
||||||
go list -m -retracted -f '{{range .Retracted}}{{.}}{{end}}' example.com/retract
|
go list -m -mod=mod -retracted -f '{{range .Retracted}}{{.}}{{end}}' example.com/retract
|
||||||
stdout '^bad$'
|
stdout '^bad$'
|
||||||
go list -m -retracted -f '{{with .Replace}}{{range .Retracted}}{{.}}{{end}}{{end}}' example.com/retract
|
go list -m -mod=mod -retracted -f '{{with .Replace}}{{range .Retracted}}{{.}}{{end}}{{end}}' example.com/retract
|
||||||
stdout '^bad$'
|
stdout '^bad$'
|
||||||
|
|
||||||
-- go.mod --
|
-- go.mod --
|
||||||
@ -38,6 +41,13 @@ require (
|
|||||||
example.com/retract v1.0.0-good
|
example.com/retract v1.0.0-good
|
||||||
example.com/retract/missingmod v1.0.0
|
example.com/retract/missingmod v1.0.0
|
||||||
)
|
)
|
||||||
|
-- use.go --
|
||||||
|
package use
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "example.com/retract"
|
||||||
|
_ "example.com/retract/missingmod"
|
||||||
|
)
|
||||||
-- missingmod-v1.0.0/go.mod --
|
-- missingmod-v1.0.0/go.mod --
|
||||||
module example.com/retract/missingmod
|
module example.com/retract/missingmod
|
||||||
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
# When we attempt to resolve an import that doesn't exist, we should not save
|
# When we attempt to resolve an import that doesn't exist, we should not save
|
||||||
# hashes for downloaded modules.
|
# hashes for downloaded modules.
|
||||||
# Verifies golang.org/issue/36260.
|
# Verifies golang.org/issue/36260.
|
||||||
go list -e -tags=ignore ./noexist
|
# TODO(golang.org/issue/26603): use 'go mod tidy -e' when implemented.
|
||||||
|
go list -e -mod=mod -tags=ignore ./noexist
|
||||||
! exists go.sum
|
! exists go.sum
|
||||||
|
|
||||||
# When an import is resolved successfully, we should only save hashes for
|
# When an import is resolved successfully, we should only save hashes for
|
||||||
# the module that provides the package, not for other modules looked up.
|
# the module that provides the package, not for other modules looked up.
|
||||||
# Verifies golang.org/issue/31580.
|
# Verifies golang.org/issue/31580.
|
||||||
go list ./exist
|
go get -d ./exist
|
||||||
grep '^example.com/join v1.1.0 h1:' go.sum
|
grep '^example.com/join v1.1.0 h1:' go.sum
|
||||||
! grep '^example.com/join/subpkg' go.sum
|
! grep '^example.com/join/subpkg' go.sum
|
||||||
cp go.sum go.list.sum
|
cp go.sum go.list.sum
|
||||||
|
@ -34,7 +34,7 @@ cmp go.sum saved.sum
|
|||||||
# Should use the checksum database to validate new go.sum lines,
|
# Should use the checksum database to validate new go.sum lines,
|
||||||
# but not need to fetch any new data from the proxy.
|
# but not need to fetch any new data from the proxy.
|
||||||
rm go.sum
|
rm go.sum
|
||||||
go list -x rsc.io/quote
|
go list -mod=mod -x rsc.io/quote
|
||||||
! stderr github
|
! stderr github
|
||||||
! stderr proxy.golang.org/rsc.io/quote
|
! stderr proxy.golang.org/rsc.io/quote
|
||||||
stderr sum.golang.org/tile
|
stderr sum.golang.org/tile
|
||||||
@ -45,7 +45,7 @@ cmp go.sum saved.sum
|
|||||||
env TESTGOPROXY404=1
|
env TESTGOPROXY404=1
|
||||||
go clean -modcache
|
go clean -modcache
|
||||||
rm go.sum
|
rm go.sum
|
||||||
go list -x rsc.io/quote
|
go list -mod=mod -x rsc.io/quote
|
||||||
stderr 'proxy.golang.org.*404 testing'
|
stderr 'proxy.golang.org.*404 testing'
|
||||||
stderr github.com/rsc
|
stderr github.com/rsc
|
||||||
cmp go.sum saved.sum
|
cmp go.sum saved.sum
|
||||||
|
5
src/cmd/go/testdata/script/mod_symlink.txt
vendored
5
src/cmd/go/testdata/script/mod_symlink.txt
vendored
@ -1,16 +1,19 @@
|
|||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
[!symlink] skip
|
[!symlink] skip
|
||||||
|
|
||||||
# 'go list' should resolve modules of imported packages.
|
# 'go get -d' should resolve modules of imported packages.
|
||||||
|
go get -d
|
||||||
go list -deps -f '{{.Module}}' .
|
go list -deps -f '{{.Module}}' .
|
||||||
stdout golang.org/x/text
|
stdout golang.org/x/text
|
||||||
|
|
||||||
|
go get -d ./subpkg
|
||||||
go list -deps -f '{{.Module}}' ./subpkg
|
go list -deps -f '{{.Module}}' ./subpkg
|
||||||
stdout golang.org/x/text
|
stdout golang.org/x/text
|
||||||
|
|
||||||
# Create a copy of the module using symlinks in src/links.
|
# Create a copy of the module using symlinks in src/links.
|
||||||
mkdir links
|
mkdir links
|
||||||
symlink links/go.mod -> $GOPATH/src/go.mod
|
symlink links/go.mod -> $GOPATH/src/go.mod
|
||||||
|
symlink links/go.sum -> $GOPATH/src/go.sum
|
||||||
symlink links/issue.go -> $GOPATH/src/issue.go
|
symlink links/issue.go -> $GOPATH/src/issue.go
|
||||||
mkdir links/subpkg
|
mkdir links/subpkg
|
||||||
symlink links/subpkg/issue.go -> $GOPATH/src/subpkg/issue.go
|
symlink links/subpkg/issue.go -> $GOPATH/src/subpkg/issue.go
|
||||||
|
1
src/cmd/go/testdata/script/mod_test.txt
vendored
1
src/cmd/go/testdata/script/mod_test.txt
vendored
@ -1,4 +1,5 @@
|
|||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
|
env GOFLAGS=-mod=mod
|
||||||
[short] skip
|
[short] skip
|
||||||
|
|
||||||
# TODO(bcmills): Convert the 'go test' calls below to 'go list -test' once 'go
|
# TODO(bcmills): Convert the 'go test' calls below to 'go list -test' once 'go
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
|
env GOFLAGS=-mod=mod
|
||||||
[short] skip
|
[short] skip
|
||||||
|
|
||||||
# golang.org/issue/30166: 'go mod tidy' should not crash if a replaced module is
|
# golang.org/issue/30166: 'go mod tidy' should not crash if a replaced module is
|
||||||
|
@ -2,6 +2,7 @@ env GO111MODULE=on
|
|||||||
[short] skip
|
[short] skip
|
||||||
|
|
||||||
# Initially, we are at v1.0.0 for all dependencies.
|
# Initially, we are at v1.0.0 for all dependencies.
|
||||||
|
go get -d
|
||||||
cp go.mod go.mod.orig
|
cp go.mod go.mod.orig
|
||||||
go list -m all
|
go list -m all
|
||||||
stdout '^patch.example.com/direct v1.0.0'
|
stdout '^patch.example.com/direct v1.0.0'
|
||||||
|
@ -5,14 +5,14 @@ env GO111MODULE=on
|
|||||||
env GOPROXY=direct
|
env GOPROXY=direct
|
||||||
|
|
||||||
cd empty
|
cd empty
|
||||||
! go list launchpad.net/gocheck
|
! go get -d launchpad.net/gocheck
|
||||||
stderr '"bzr": executable file not found'
|
stderr '"bzr": executable file not found'
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
# 1.11 used to give the cryptic error "cannot find module for path" here, but
|
# 1.11 used to give the cryptic error "cannot find module for path" here, but
|
||||||
# only for a main package.
|
# only for a main package.
|
||||||
cd main
|
cd main
|
||||||
! go build
|
! go build -mod=mod
|
||||||
stderr '"bzr": executable file not found'
|
stderr '"bzr": executable file not found'
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
[short] skip
|
[short] skip
|
||||||
|
|
||||||
|
# Populate go.mod and go.sum.
|
||||||
|
go mod tidy
|
||||||
|
|
||||||
# initial conditions: using sampler v1.3.0, not listed in go.mod.
|
# initial conditions: using sampler v1.3.0, not listed in go.mod.
|
||||||
go list -deps
|
go list -deps
|
||||||
stdout rsc.io/sampler
|
stdout rsc.io/sampler
|
||||||
|
2
src/cmd/go/testdata/script/mod_verify.txt
vendored
2
src/cmd/go/testdata/script/mod_verify.txt
vendored
@ -56,7 +56,7 @@ go mod tidy
|
|||||||
# Packages below module root should not be mentioned in go.sum.
|
# Packages below module root should not be mentioned in go.sum.
|
||||||
rm go.sum
|
rm go.sum
|
||||||
go mod edit -droprequire rsc.io/quote
|
go mod edit -droprequire rsc.io/quote
|
||||||
go list rsc.io/quote/buggy # re-resolves import path and updates go.mod
|
go get -d rsc.io/quote/buggy
|
||||||
grep '^rsc.io/quote v1.5.2/go.mod ' go.sum
|
grep '^rsc.io/quote v1.5.2/go.mod ' go.sum
|
||||||
! grep buggy go.sum
|
! grep buggy go.sum
|
||||||
|
|
||||||
|
3
src/cmd/go/testdata/script/mod_why.txt
vendored
3
src/cmd/go/testdata/script/mod_why.txt
vendored
@ -1,6 +1,9 @@
|
|||||||
env GO111MODULE=on
|
env GO111MODULE=on
|
||||||
[short] skip
|
[short] skip
|
||||||
|
|
||||||
|
# Populate go.sum.
|
||||||
|
go mod tidy
|
||||||
|
|
||||||
go list -test all
|
go list -test all
|
||||||
stdout rsc.io/quote
|
stdout rsc.io/quote
|
||||||
stdout golang.org/x/text/language
|
stdout golang.org/x/text/language
|
||||||
|
6
src/cmd/go/testdata/script/modfile_flag.txt
vendored
6
src/cmd/go/testdata/script/modfile_flag.txt
vendored
@ -37,10 +37,10 @@ go mod why rsc.io/quote
|
|||||||
# 'go list' and other commands with build flags should work.
|
# 'go list' and other commands with build flags should work.
|
||||||
# They should update the alternate go.mod when a dependency is missing.
|
# They should update the alternate go.mod when a dependency is missing.
|
||||||
go mod edit -droprequire rsc.io/quote
|
go mod edit -droprequire rsc.io/quote
|
||||||
go list .
|
go list -mod=mod .
|
||||||
grep rsc.io/quote go.alt.mod
|
grep rsc.io/quote go.alt.mod
|
||||||
go build -n .
|
go build -n -mod=mod .
|
||||||
go test -n .
|
go test -n -mod=mod .
|
||||||
go get -d rsc.io/quote
|
go get -d rsc.io/quote
|
||||||
|
|
||||||
|
|
||||||
|
1
src/cmd/go/testdata/script/version.txt
vendored
1
src/cmd/go/testdata/script/version.txt
vendored
@ -14,6 +14,7 @@ env GO111MODULE=on
|
|||||||
[short] skip
|
[short] skip
|
||||||
|
|
||||||
# Check that 'go version' and 'go version -m' work on a binary built in module mode.
|
# Check that 'go version' and 'go version -m' work on a binary built in module mode.
|
||||||
|
go get -d rsc.io/fortune
|
||||||
go build -o fortune.exe rsc.io/fortune
|
go build -o fortune.exe rsc.io/fortune
|
||||||
go version fortune.exe
|
go version fortune.exe
|
||||||
stdout '^fortune.exe: .+'
|
stdout '^fortune.exe: .+'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[short] skip
|
[short] skip
|
||||||
|
|
||||||
go mod download example.com/printversion@v0.1.0 example.com/printversion@v1.0.0
|
go mod download example.com/printversion@v0.1.0 example.com/printversion@v1.0.0
|
||||||
|
go get -d example.com/printversion@v0.1.0
|
||||||
go install example.com/printversion
|
go install example.com/printversion
|
||||||
|
|
||||||
go run example.com/printversion
|
go run example.com/printversion
|
||||||
|
Loading…
Reference in New Issue
Block a user