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

     1  env GO111MODULE=on
     2  [short] skip
     3  
     4  # If a pattern doesn't match any packages provided by modules
     5  # in the build list, we assume the pattern matches a single module
     6  # whose path is a prefix of the part of the pattern before "...".
     7  cp go.mod.orig go.mod
     8  go get rsc.io/quote/...
     9  grep 'require rsc.io/quote' go.mod
    10  
    11  cp go.mod.orig go.mod
    12  ! go get rsc.io/quote/x...
    13  stderr 'go: module rsc.io/quote@upgrade found \(v1.5.2\), but does not contain packages matching rsc.io/quote/x...'
    14  ! grep 'require rsc.io/quote' go.mod
    15  
    16  ! go get rsc.io/quote/x/...
    17  stderr 'go: module rsc.io/quote@upgrade found \(v1.5.2\), but does not contain packages matching rsc.io/quote/x/...'
    18  ! grep 'require rsc.io/quote' go.mod
    19  
    20  # If a pattern matches no packages within a module, the module should not
    21  # be upgraded, even if the module path is a prefix of the pattern.
    22  cp go.mod.orig go.mod
    23  go mod edit -require example.com/nest@v1.0.0
    24  go get example.com/nest/sub/y...
    25  grep 'example.com/nest/sub v1.0.0' go.mod
    26  grep 'example.com/nest v1.0.0' go.mod
    27  
    28  # However, if the pattern matches the module path itself, the module
    29  # should be upgraded even if it contains no matching packages.
    30  go get example.com/n...t
    31  grep 'example.com/nest v1.1.0' go.mod
    32  grep 'example.com/nest/sub v1.0.0' go.mod
    33  
    34  -- go.mod.orig --
    35  module m
    36  
    37  go 1.13
    38  
    39  -- use/use.go --
    40  package use
    41  
    42  import _ "rsc.io/quote"
    43  

View as plain text