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

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

View as plain text