...

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

Documentation: cmd/go/testdata/script

     1env GO111MODULE=on
     2
     3# By default, 'go get' should ignore tests
     4cp go.mod.empty go.mod
     5go get m/a
     6! grep rsc.io/quote go.mod
     7
     8# 'go get -t' should consider test dependencies of the named package.
     9cp go.mod.empty go.mod
    10go get -t m/a
    11grep 'rsc.io/quote v1.5.2$' go.mod
    12
    13# 'go get -t' should not consider test dependencies of imported packages,
    14# including packages imported from tests.
    15cp go.mod.empty go.mod
    16go get -t m/b
    17! grep rsc.io/quote go.mod
    18
    19# 'go get -t -u' should update test dependencies of the named package.
    20cp go.mod.empty go.mod
    21go mod edit -require=rsc.io/quote@v1.5.1
    22go get -t -u m/a
    23grep 'rsc.io/quote v1.5.2$' go.mod
    24
    25# 'go get -t -u' should not add or update test dependencies
    26# of imported packages, including packages imported from tests.
    27cp go.mod.empty go.mod
    28go get -t -u m/b
    29! grep rsc.io/quote go.mod
    30go mod edit -require=rsc.io/quote@v1.5.1
    31go get -t -u m/b
    32grep 'rsc.io/quote v1.5.1$' go.mod
    33
    34# 'go get all' should consider test dependencies with or without -t.
    35cp go.mod.empty go.mod
    36go get all
    37grep 'rsc.io/quote v1.5.2$' go.mod
    38
    39-- go.mod.empty --
    40module m
    41
    42-- a/a.go --
    43package a
    44
    45-- a/a_test.go --
    46package a_test
    47
    48import _ "rsc.io/quote"
    49
    50-- b/b.go --
    51package b
    52
    53import _ "m/a"
    54
    55-- b/b_test.go --
    56package b_test
    57
    58import _ "m/a"

View as plain text