github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/script/mod_enabled.txt (about) 1 # GO111MODULE=auto should trigger any time a go.mod exists in a parent directory. 2 env GO111MODULE=auto 3 4 cd $GOPATH/src/x/y/z 5 go env GOMOD 6 stdout $GOPATH[/\\]src[/\\]x[/\\]y[/\\]z[/\\]go.mod 7 go list -m -f {{.GoMod}} 8 stdout $GOPATH[/\\]src[/\\]x[/\\]y[/\\]z[/\\]go.mod 9 10 cd $GOPATH/src/x/y/z/w 11 go env GOMOD 12 stdout $GOPATH[/\\]src[/\\]x[/\\]y[/\\]z[/\\]go.mod 13 14 cd $GOPATH/src/x/y 15 go env GOMOD 16 ! stdout . 17 18 cd $GOPATH/foo 19 go env GOMOD 20 stdout foo[/\\]go.mod 21 go list -m -f {{.GoMod}} 22 stdout foo[/\\]go.mod 23 24 cd $GOPATH/foo/bar/baz 25 go env GOMOD 26 stdout foo[/\\]go.mod 27 28 # GO111MODULE unset should be equivalent to auto. 29 env GO111MODULE= 30 31 cd $GOPATH/src/x/y/z 32 go env GOMOD 33 stdout $GOPATH[/\\]src[/\\]x[/\\]y[/\\]z[/\\]go.mod 34 35 cd $GOPATH/src/x/y 36 go env GOMOD 37 ! stdout . 38 39 # GO111MODULE=on should trigger everywhere 40 env GO111MODULE=on 41 42 cd $GOPATH/src/x/y/z 43 go env GOMOD 44 stdout z[/\\]go.mod 45 46 cd $GOPATH/src/x/y/z/w 47 go env GOMOD 48 stdout z[/\\]go.mod 49 50 cd $GOPATH/src/x/y 51 go env GOMOD 52 stdout 'NUL|/dev/null' 53 go list -m 54 stdout '^command-line-arguments$' 55 56 cd $GOPATH/foo 57 go env GOMOD 58 stdout foo[/\\]go.mod 59 60 cd $GOPATH/foo/bar/baz 61 go env GOMOD 62 stdout foo[/\\]go.mod 63 64 # GO111MODULE=off should trigger nowhere 65 env GO111MODULE=off 66 67 cd $GOPATH/src/x/y/z 68 go env GOMOD 69 ! stdout .+ 70 71 cd $GOPATH/foo 72 go env GOMOD 73 ! stdout .+ 74 75 cd $GOPATH/foo/bar/baz 76 go env GOMOD 77 ! stdout .+ 78 79 # GO111MODULE=auto should ignore and warn about /tmp/go.mod 80 env GO111MODULE=auto 81 cp $GOPATH/src/x/y/z/go.mod $WORK/tmp/go.mod 82 mkdir $WORK/tmp/mydir 83 cd $WORK/tmp/mydir 84 go env GOMOD 85 ! stdout .+ 86 stderr '^go: warning: ignoring go.mod in system temp root ' 87 88 -- $GOPATH/src/x/y/z/go.mod -- 89 module x/y/z 90 -- $GOPATH/src/x/y/z/w/w.txt -- 91 -- $GOPATH/foo/go.mod -- 92 module example.com/mod 93 -- $GOPATH/foo/bar/baz/quux.txt --