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

     1  cp go.mod go.mod.orig
     2  
     3  # getting a specific version of a module along with a pattern
     4  # not yet present in that module should report the version mismatch
     5  # rather than a "matched no packages" warning.
     6  
     7  ! go get example.net/pkgadded@v1.1.0 example.net/pkgadded/subpkg/...
     8  stderr '^go: example.net/pkgadded@v1.1.0 conflicts with example.net/pkgadded/subpkg/...@upgrade \(v1.2.0\)$'
     9  ! stderr 'matched no packages'
    10  cmp go.mod.orig go.mod
    11  
    12  
    13  # A wildcard pattern should match the pattern with that path.
    14  
    15  go get example.net/pkgadded/...@v1.0.0
    16  go list -m all
    17  stdout '^example.net/pkgadded v1.0.0'
    18  cp go.mod.orig go.mod
    19  
    20  
    21  # If we need to resolve a transitive dependency of a package,
    22  # and another argument constrains away the version that provides that
    23  # package, then 'go get' should fail with a useful error message.
    24  
    25  ! go get example.net/pkgadded@v1.0.0 .
    26  stderr '^example.com/m imports\n\texample.net/pkgadded/subpkg: cannot find module providing package example.net/pkgadded/subpkg$'
    27  ! stderr 'example.net/pkgadded v1\.2\.0'
    28  cmp go.mod.orig go.mod
    29  
    30  go get example.net/pkgadded@v1.0.0
    31  ! go list -deps -mod=readonly .
    32  stderr '^m.go:3:8: cannot find module providing package example\.net/pkgadded/subpkg: '
    33  
    34  -- go.mod --
    35  module example.com/m
    36  
    37  go 1.16
    38  
    39  require example.net/pkgadded v1.2.0
    40  -- m.go --
    41  package m
    42  
    43  import _ "example.net/pkgadded/subpkg"
    44  

View as plain text