...

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

Documentation: cmd/go/testdata/script

     1env GO111MODULE=on
     2
     3# list excluded version
     4go list -modfile=go.exclude.mod -m rsc.io/quote@v1.5.0
     5stdout '^rsc.io/quote v1.5.0$'
     6
     7# list versions should not print excluded versions
     8go list -m -versions rsc.io/quote
     9stdout '\bv1.5.0\b'
    10go list -modfile=go.exclude.mod -m -versions rsc.io/quote
    11! stdout '\bv1.5.0\b'
    12
    13# list query with excluded version
    14go list -m rsc.io/quote@>=v1.5
    15stdout '^rsc.io/quote v1.5.0$'
    16go list -modfile=go.exclude.mod -m rsc.io/quote@>=v1.5
    17stdout '^rsc.io/quote v1.5.1$'
    18
    19# get excluded version
    20cp go.exclude.mod go.exclude.mod.orig
    21! go get -modfile=go.exclude.mod rsc.io/quote@v1.5.0
    22stderr '^go: rsc.io/quote@v1.5.0: excluded by go.mod$'
    23
    24# get non-excluded version
    25cp go.exclude.mod.orig go.exclude.mod
    26go get -modfile=go.exclude.mod rsc.io/quote@v1.5.1
    27stderr 'rsc.io/quote v1.5.1'
    28
    29# get query with excluded version
    30cp go.exclude.mod.orig go.exclude.mod
    31go get -modfile=go.exclude.mod rsc.io/quote@>=v1.5
    32go list -modfile=go.exclude.mod -m ...quote
    33stdout 'rsc.io/quote v1.5.[1-9]'
    34
    35-- go.mod --
    36module x
    37
    38-- go.exclude.mod --
    39module x
    40
    41exclude rsc.io/quote v1.5.0
    42
    43-- x.go --
    44package x
    45import _ "rsc.io/quote"
    46

View as plain text