...

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

Documentation: cmd/go/testdata/script

     1# 'go mod download' can download specific versions of the main module.
     2go mod download rsc.io/quote@5d9f230b
     3go mod download rsc.io/quote@v1.5.2
     4go mod download rsc.io/quote@latest
     5
     6# 'go mod download' will not download @upgrade or @patch, since they always
     7# resolve to the main module.
     8go mod download rsc.io/quote@upgrade
     9stderr '^go: skipping download of rsc.io/quote@upgrade that resolves to the main module$'
    10go mod download rsc.io/quote@patch
    11stderr '^go: skipping download of rsc.io/quote@patch that resolves to the main module$'
    12
    13# 'go list -m' can show a version of the main module.
    14go list -m rsc.io/quote@5d9f230b
    15stdout '^rsc.io/quote v0.0.0-20180710144737-5d9f230bcfba$'
    16go list -m rsc.io/quote@v1.5.2
    17stdout '^rsc.io/quote v1.5.2$'
    18go list -m rsc.io/quote@latest
    19stdout '^rsc.io/quote v1.5.2$'
    20
    21# 'go list -m -versions' shows available versions.
    22go list -m -versions rsc.io/quote
    23stdout '^rsc.io/quote.*v1.5.2'
    24
    25# 'go list -m' resolves @upgrade and @patch to the main module.
    26go list -m rsc.io/quote@upgrade
    27stdout '^rsc.io/quote$'
    28go list -m rsc.io/quote@patch
    29stdout '^rsc.io/quote$'
    30
    31# 'go get' will not attempt to upgrade the main module to any specific version.
    32# See also: mod_get_main.txt.
    33! go get rsc.io/quote@5d9f230b
    34stderr '^go: can''t request version "5d9f230b" of the main module \(rsc.io/quote\)$'
    35! go get rsc.io/quote@v1.5.2
    36stderr '^go: can''t request version "v1.5.2" of the main module \(rsc.io/quote\)$'
    37! go get rsc.io/quote@latest
    38stderr '^go: can''t request version "latest" of the main module \(rsc.io/quote\)$'
    39
    40-- go.mod --
    41module rsc.io/quote
    42
    43go 1.16

View as plain text