...

Text file src/cmd/go/testdata/script/mod_enabled.txt

Documentation: cmd/go/testdata/script

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

View as plain text