...

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

Documentation: cmd/go/testdata/script

     1env GO111MODULE=on
     2[short] skip
     3
     4# downgrade sampler should downgrade quote
     5cp go.mod.orig go.mod
     6go get rsc.io/sampler@v1.0.0
     7go list -m all
     8stdout 'rsc.io/quote v1.4.0'
     9stdout 'rsc.io/sampler v1.0.0'
    10
    11# downgrade sampler away should downgrade quote further
    12go get rsc.io/sampler@none
    13go list -m all
    14stdout 'rsc.io/quote v1.3.0'
    15
    16# downgrade should report inconsistencies and not change go.mod
    17go get rsc.io/quote@v1.5.1
    18go list -m all
    19stdout 'rsc.io/quote v1.5.1'
    20stdout 'rsc.io/sampler v1.3.0'
    21
    22! go get rsc.io/sampler@v1.0.0 rsc.io/quote@v1.5.2 golang.org/x/text@none
    23! stderr add|remove|upgrad|downgrad
    24stderr '^go: rsc.io/quote@v1.5.2 requires rsc.io/sampler@v1.3.0, not rsc.io/sampler@v1.0.0$'
    25
    26go list -m all
    27stdout 'rsc.io/quote v1.5.1'
    28stdout 'rsc.io/sampler v1.3.0'
    29
    30# go get -u args should limit upgrades
    31cp go.mod.empty go.mod
    32go get -u rsc.io/quote@v1.4.0 rsc.io/sampler@v1.0.0
    33go list -m all
    34stdout 'rsc.io/quote v1.4.0'
    35stdout 'rsc.io/sampler v1.0.0'
    36! stdout golang.org/x/text
    37
    38# downgrading away quote should also downgrade away latemigrate/v2,
    39# since there are no older versions. v2.0.0 is incompatible.
    40cp go.mod.orig go.mod
    41go list -m -versions example.com/latemigrate/v2
    42stdout v2.0.0 # proxy may serve incompatible versions
    43go get rsc.io/quote@none
    44go list -m all
    45! stdout 'example.com/latemigrate/v2'
    46
    47-- go.mod.orig --
    48module x
    49require (
    50	rsc.io/quote v1.5.1
    51	example.com/latemigrate/v2 v2.0.1
    52)
    53-- go.mod.empty --
    54module x
    55-- x.go --
    56package x

View as plain text