| 1 |
env GO111MODULE=on |
| 2 |
|
| 3 |
# File system pattern searches should skip sub-modules and vendor directories. |
| 4 |
cd x |
| 5 |
|
| 6 |
# all packages |
| 7 |
go list all |
| 8 |
stdout ^m$ |
| 9 |
stdout ^m/vendor$ |
| 10 |
! stdout vendor/ |
| 11 |
stdout ^m/y$ |
| 12 |
! stdout ^m/y/z |
| 13 |
|
| 14 |
# path pattern |
| 15 |
go list m/... |
| 16 |
stdout ^m$ |
| 17 |
stdout ^m/vendor$ |
| 18 |
! stdout vendor/ |
| 19 |
stdout ^m/y$ |
| 20 |
! stdout ^m/y/z |
| 21 |
|
| 22 |
# directory pattern |
| 23 |
go list ./... |
| 24 |
stdout ^m$ |
| 25 |
stdout ^m/vendor$ |
| 26 |
! stdout vendor/ |
| 27 |
stdout ^m/y$ |
| 28 |
! stdout ^m/y/z |
| 29 |
|
| 30 |
# non-existent directory should not prompt lookups |
| 31 |
! go build -mod=readonly example.com/nonexist |
| 32 |
stderr 'import lookup disabled' |
| 33 |
|
| 34 |
! go build -mod=readonly ./nonexist |
| 35 |
! stderr 'import lookup disabled' |
| 36 |
stderr '^stat '$GOPATH'[/\\]src[/\\]x[/\\]nonexist: directory not found' |
| 37 |
|
| 38 |
! go build -mod=readonly ./go.mod |
| 39 |
! stderr 'import lookup disabled' |
| 40 |
stderr 'main module \(m\) does not contain package m/go.mod' |
| 41 |
|
| 42 |
|
| 43 |
# File system paths and patterns should allow the '@' character. |
| 44 |
cd ../@at |
| 45 |
go list $PWD |
| 46 |
stdout '^at$' |
| 47 |
go list $PWD/... |
| 48 |
stdout '^at$' |
| 49 |
|
| 50 |
# The '@' character is not allowed in directory paths that are part of |
| 51 |
# a package path. |
| 52 |
cd ../badat/bad@ |
| 53 |
! go list . |
| 54 |
stderr 'current directory outside main module or its selected dependencies' |
| 55 |
! go list $PWD |
| 56 |
stderr 'current directory outside main module or its selected dependencies' |
| 57 |
! go list $PWD/... |
| 58 |
stderr 'current directory outside main module or its selected dependencies' |
| 59 |
|
| 60 |
-- x/go.mod -- |
| 61 |
module m |
| 62 |
|
| 63 |
-- x/x.go -- |
| 64 |
package x |
| 65 |
|
| 66 |
-- x/vendor/v/v.go -- |
| 67 |
package v |
| 68 |
import _ "golang.org/x/crypto" |
| 69 |
|
| 70 |
-- x/vendor/v.go -- |
| 71 |
package main |
| 72 |
|
| 73 |
-- x/y/y.go -- |
| 74 |
package y |
| 75 |
|
| 76 |
-- x/y/z/go.mod -- |
| 77 |
syntax error! |
| 78 |
|
| 79 |
-- x/y/z/z.go -- |
| 80 |
package z |
| 81 |
|
| 82 |
-- x/y/z/w/w.go -- |
| 83 |
package w |
| 84 |
|
| 85 |
-- @at/go.mod -- |
| 86 |
module at |
| 87 |
|
| 88 |
go 1.14 |
| 89 |
-- @at/at.go -- |
| 90 |
package at |
| 91 |
|
| 92 |
-- badat/go.mod -- |
| 93 |
module badat |
| 94 |
|
| 95 |
go 1.14 |
| 96 |
-- badat/bad@/bad.go -- |
| 97 |
package bad |