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

     1  # retract must not be used without a module directive.
     2  ! go list -m all
     3  stderr 'go.mod:3: no module directive found, so retract cannot be used$'
     4  
     5  # Commands that update go.mod should fix non-canonical versions in
     6  # retract directives.
     7  # Verifies #44494.
     8  go mod edit -module=rsc.io/quote/v2
     9  ! go list -m all
    10  stderr '^go: updates to go.mod needed; to update it:\n\tgo mod tidy$'
    11  go mod tidy
    12  go list -m all
    13  cmp go.mod go.mod.want
    14  
    15  # If a retracted version doesn't match the module's major version suffx,
    16  # an error should be reported.
    17  ! go mod edit -retract=v3.0.1
    18  stderr '^go: -retract=v3.0.1: version "v3.0.1" invalid: should be v2, not v3$'
    19  cp go.mod.mismatch-v2 go.mod
    20  ! go list -m all
    21  stderr 'go.mod:3: retract rsc.io/quote/v2: version "v3.0.1" invalid: should be v2, not v3$'
    22  
    23  cp go.mod.mismatch-v1 go.mod
    24  ! go list -m all
    25  stderr 'go.mod:3: retract rsc.io/quote: version "v3.0.1" invalid: should be v0 or v1, not v3$'
    26  
    27  -- go.mod --
    28  go 1.16
    29  
    30  retract latest
    31  -- go.mod.want --
    32  go 1.16
    33  
    34  retract v2.0.1
    35  
    36  module rsc.io/quote/v2
    37  -- go.mod.mismatch-v2 --
    38  go 1.16
    39  
    40  retract v3.0.1
    41  
    42  module rsc.io/quote/v2
    43  -- go.mod.mismatch-v1 --
    44  go 1.16
    45  
    46  retract v3.0.1
    47  
    48  module rsc.io/quote
    49  

View as plain text