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

     1  env GO111MODULE=on
     2  
     3  # For this test module there are three versions:
     4  #   * v0.1.1-0.20190429073117-b5426c86b553
     5  #   * v0.1.0
     6  #   * v0.0.0-20190430073000-30950c05d534
     7  # Only v0.1.0 is tagged.
     8  #
     9  # The v0.1.1 pseudo-version is semantically higher than the latest tag.
    10  # The v0.0.0 pseudo-version is chronologically newer.
    11  
    12  # Start at v0.1.1-0.20190429073117-b5426c86b553
    13  go get example.com/pseudoupgrade@b5426c8
    14  go list -m -u all
    15  stdout '^example.com/pseudoupgrade v0.1.1-0.20190429073117-b5426c86b553$'
    16  
    17  # 'get -u' should not downgrade to the (lower) tagged version.
    18  go get -u
    19  go list -m -u all
    20  stdout '^example.com/pseudoupgrade v0.1.1-0.20190429073117-b5426c86b553$'
    21  
    22  # 'get example.com/pseudoupgrade@upgrade' should not downgrade.
    23  go get example.com/pseudoupgrade@upgrade
    24  go list -m all
    25  stdout '^example.com/pseudoupgrade v0.1.1-0.20190429073117-b5426c86b553$'
    26  
    27  # 'get example.com/pseudoupgrade' should not downgrade.
    28  # This is equivalent to 'get example.com/pseudoupgrade@upgrade'.
    29  go get example.com/pseudoupgrade
    30  go list -m all
    31  stdout '^example.com/pseudoupgrade v0.1.1-0.20190429073117-b5426c86b553$'
    32  
    33  # 'get example.com/pseudoupgrade@latest' should downgrade.
    34  # @latest should not consider the current version.
    35  go get example.com/pseudoupgrade@latest
    36  go list -m all
    37  stdout '^example.com/pseudoupgrade v0.1.0$'
    38  
    39  # We should observe the same behavior with the newer pseudo-version.
    40  go get example.com/pseudoupgrade@v0.0.0-20190430073000-30950c05d534
    41  
    42  # 'get -u' should not downgrade to the chronologically older tagged version.
    43  go get -u
    44  go list -m -u all
    45  stdout '^example.com/pseudoupgrade v0.0.0-20190430073000-30950c05d534$'
    46  
    47  # 'get example.com/pseudoupgrade@upgrade should not downgrade.
    48  go get example.com/pseudoupgrade@upgrade
    49  go list -m -u all
    50  stdout '^example.com/pseudoupgrade v0.0.0-20190430073000-30950c05d534$'
    51  
    52  # 'get example.com/pseudoupgrade' should not downgrade.
    53  go get example.com/pseudoupgrade
    54  go list -m -u all
    55  stdout '^example.com/pseudoupgrade v0.0.0-20190430073000-30950c05d534$'
    56  
    57  # 'get example.com/pseudoupgrade@latest' should downgrade.
    58  go get example.com/pseudoupgrade@latest
    59  go list -m -u all
    60  stdout '^example.com/pseudoupgrade v0.1.0$'
    61  
    62  -- go.mod --
    63  module x
    64  
    65  go 1.12
    66  
    67  -- main.go --
    68  package x
    69  
    70  import _ "example.com/pseudoupgrade"
    71  

View as plain text