...

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

Documentation: cmd/go/testdata/script

     1cp 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/...
     8stderr '^go: example.net/pkgadded@v1.1.0 conflicts with example.net/pkgadded/subpkg/...@upgrade \(v1.2.0\)$'
     9! stderr 'matched no packages'
    10cmp go.mod.orig go.mod
    11
    12
    13# A wildcard pattern should match the pattern with that path.
    14
    15go get example.net/pkgadded/...@v1.0.0
    16go list -m all
    17stdout '^example.net/pkgadded v1.0.0'
    18cp 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 .
    26stderr '^go: 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'
    28cmp go.mod.orig go.mod
    29
    30go get example.net/pkgadded@v1.0.0
    31! go list -deps -mod=readonly .
    32stderr '^m.go:3:8: cannot find module providing package example\.net/pkgadded/subpkg: '
    33
    34-- go.mod --
    35module example.com/m
    36
    37go 1.16
    38
    39require example.net/pkgadded v1.2.0
    40-- m.go --
    41package m
    42
    43import _ "example.net/pkgadded/subpkg"

View as plain text