diff options
Diffstat (limited to 'libgo/go/cmd/go/testdata/script/mod_list.txt')
-rw-r--r-- | libgo/go/cmd/go/testdata/script/mod_list.txt | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/libgo/go/cmd/go/testdata/script/mod_list.txt b/libgo/go/cmd/go/testdata/script/mod_list.txt new file mode 100644 index 00000000000..2fa079f49ae --- /dev/null +++ b/libgo/go/cmd/go/testdata/script/mod_list.txt @@ -0,0 +1,60 @@ +env GO111MODULE=on + +# list {{.Dir}} shows main module and go.mod but not not-yet-downloaded dependency dir. +go list -m -f '{{.Path}} {{.Main}} {{.GoMod}} {{.Dir}}' all +stdout '^x true .*[\\/]src[\\/]go.mod .*[\\/]src$' +stdout '^rsc.io/quote false .*[\\/]v1.5.2.mod $' + +# list {{.Dir}} shows dependency after download (and go list without -m downloads it) +go list -f '{{.Dir}}' rsc.io/quote +stdout '.*mod[\\/]rsc.io[\\/]quote@v1.5.2$' + +# downloaded dependencies are read-only +exists -readonly $GOPATH/pkg/mod/rsc.io/quote@v1.5.2 +exists -readonly $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/buggy + +# go clean -modcache can delete read-only dependencies +go clean -modcache +! exists $GOPATH/pkg/mod/rsc.io/quote@v1.5.2 + +# list {{.Dir}} shows replaced directories +cp go.mod2 go.mod +go list -f {{.Dir}} rsc.io/quote +go list -m -f '{{.Path}} {{.Version}} {{.Dir}}{{with .Replace}} {{.GoMod}} => {{.Version}} {{.Dir}} {{.GoMod}}{{end}}' all +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' + +# list std should work +go list std +[!gccgo] stdout ^math/big + +# rsc.io/quote/buggy should be listable as a package +go list rsc.io/quote/buggy + +# rsc.io/quote/buggy should not be listable as a module +go list -m -e -f '{{.Error.Err}}' nonexist rsc.io/quote/buggy +stdout '^module "nonexist" is not a known dependency' +stdout '^module "rsc.io/quote/buggy" is not a known dependency' + +! go list -m nonexist rsc.io/quote/buggy +stderr '^go list -m nonexist: module "nonexist" is not a known dependency' +stderr '^go list -m rsc.io/quote/buggy: module "rsc.io/quote/buggy" is not a known dependency' + +# Module loader does not interfere with list -e (golang.org/issue/24149). +[!gccgo] go list -e -f '{{.Error.Err}}' database +[!gccgo] stdout 'no Go files in ' +[!gccgo] ! go list database +[!gccgo] stderr 'no Go files in ' + +-- go.mod -- +module x +require rsc.io/quote v1.5.2 + +-- go.mod2 -- +module x +require rsc.io/quote v1.5.1 +replace rsc.io/sampler v1.3.0 => rsc.io/sampler v1.3.1 + +-- x.go -- +package x +import _ "rsc.io/quote" |