| env GO111MODULE=on |
| |
| # File system pattern searches should skip sub-modules and vendor directories. |
| cd x |
| |
| # all packages |
| go list all |
| stdout ^m$ |
| stdout ^m/vendor$ |
| ! stdout vendor/ |
| stdout ^m/y$ |
| ! stdout ^m/y/z |
| |
| # path pattern |
| go list m/... |
| stdout ^m$ |
| stdout ^m/vendor$ |
| ! stdout vendor/ |
| stdout ^m/y$ |
| ! stdout ^m/y/z |
| |
| # directory pattern |
| go list ./... |
| stdout ^m$ |
| stdout ^m/vendor$ |
| ! stdout vendor/ |
| stdout ^m/y$ |
| ! stdout ^m/y/z |
| |
| # non-existent directory should not prompt lookups |
| ! go build -mod=readonly example.com/nonexist |
| stderr 'import lookup disabled' |
| |
| ! go build -mod=readonly ./nonexist |
| ! stderr 'import lookup disabled' |
| stderr '^stat '$GOPATH'[/\\]src[/\\]x[/\\]nonexist: directory not found' |
| |
| ! go build -mod=readonly ./go.mod |
| ! stderr 'import lookup disabled' |
| stderr 'main module \(m\) does not contain package m/go.mod' |
| |
| |
| # File system paths and patterns should allow the '@' character. |
| cd ../@at |
| go list $PWD |
| stdout '^at$' |
| go list $PWD/... |
| stdout '^at$' |
| |
| # The '@' character is not allowed in directory paths that are part of |
| # a package path. |
| cd ../badat/bad@ |
| ! go list . |
| stderr 'directory . outside available modules' |
| ! go list $PWD |
| stderr 'directory . outside available modules' |
| ! go list $PWD/... |
| stderr 'directory . outside available modules' |
| |
| -- x/go.mod -- |
| module m |
| |
| -- x/x.go -- |
| package x |
| |
| -- x/vendor/v/v.go -- |
| package v |
| import _ "golang.org/x/crypto" |
| |
| -- x/vendor/v.go -- |
| package main |
| |
| -- x/y/y.go -- |
| package y |
| |
| -- x/y/z/go.mod -- |
| syntax error! |
| |
| -- x/y/z/z.go -- |
| package z |
| |
| -- x/y/z/w/w.go -- |
| package w |
| |
| -- @at/go.mod -- |
| module at |
| |
| go 1.14 |
| -- @at/at.go -- |
| package at |
| |
| -- badat/go.mod -- |
| module badat |
| |
| go 1.14 |
| -- badat/bad@/bad.go -- |
| package bad |