blob: 1597ebbf12d9110822ac46dfa24fdcb0e048d99b [file] [log] [blame]
env GO111MODULE=on
# list {{.Dir}} shows main module but not not-yet-downloaded dependency
go list -m -f '{{.Path}} {{.Main}} {{.Dir}}' all
stdout '^x true .*[\\/]src$'
stdout '^ false $'
# list {{.Dir}} shows dependency after download
go list -f {{.Dir}}
stdout 'mod[\\/][\\/]quote@v1.5.2'
# downloaded dependencies are read-only
exists -readonly $GOPATH/src/mod/
exists -readonly $GOPATH/src/mod/
# go clean -modcache can delete read-only dependencies
go clean -modcache
! exists $GOPATH/src/mod/
# list {{.Dir}} shows replaced directories
cp go.mod2 go.mod
go list -f {{.Dir}}
go list -m -f '{{.Path}} {{.Version}} {{.Dir}}{{with .Replace}} => {{.Version}} {{.Dir}}{{end}}' all
stdout 'mod[\\/][\\/]quote@v1.5.1'
stdout 'v1.3.0.*mod[\\/][\\/]sampler@v1.3.1 => v1.3.1.*sampler@v1.3.1'
# list std should work
go list std
stdout ^math/big
# should be listable as a package
go list
# should not be listable as a module
go list -m -e -f '{{.Error.Err}}' nonexist
stdout '^module "nonexist" is not a known dependency'
stdout '^module "" is not a known dependency'
! go list -m nonexist
stderr '^go list -m nonexist: module "nonexist" is not a known dependency'
stderr '^go list -m module "" is not a known dependency'
# Module loader does not interfere with list -e (
go list -e -f '{{.Error.Err}}' database
stdout 'no Go files in '
! go list database
stderr 'no Go files in '
-- go.mod --
module x
require v1.5.2
-- go.mod2 --
module x
require v1.5.1
replace v1.3.0 => v1.3.1
-- x.go --
package x
import _ ""