blob: f5f415aa3fae25e66ec10e62a04469c14c115157 [file] [log] [blame]
env GO111MODULE=on
# For this test module there are three versions:
# * v0.1.1-0.20190429073117-b5426c86b553
# * v0.1.0
# * v0.0.0-20190430073000-30950c05d534
# Only v0.1.0 is tagged.
#
# The v0.1.1 pseudo-version is semantically higher than the latest tag.
# The v0.0.0 pseudo-version is chronologically newer.
# Start at v0.1.1-0.20190429073117-b5426c86b553
go get -d example.com/pseudoupgrade@b5426c8
go list -m -u all
stdout '^example.com/pseudoupgrade v0.1.1-0.20190429073117-b5426c86b553$'
# 'get -u' should not downgrade to the (lower) tagged version.
go get -d -u
go list -m -u all
stdout '^example.com/pseudoupgrade v0.1.1-0.20190429073117-b5426c86b553$'
# 'get example.com/pseudoupgrade@upgrade' should not downgrade.
go get -d example.com/pseudoupgrade@upgrade
go list -m all
stdout '^example.com/pseudoupgrade v0.1.1-0.20190429073117-b5426c86b553$'
# 'get example.com/pseudoupgrade' should not downgrade.
# This is equivalent to 'get example.com/pseudoupgrade@upgrade'.
go get -d example.com/pseudoupgrade
go list -m all
stdout '^example.com/pseudoupgrade v0.1.1-0.20190429073117-b5426c86b553$'
# 'get example.com/pseudoupgrade@latest' should downgrade.
# @latest should not consider the current version.
go get -d example.com/pseudoupgrade@latest
go list -m all
stdout '^example.com/pseudoupgrade v0.1.0$'
# We should observe the same behavior with the newer pseudo-version.
go get -d example.com/pseudoupgrade@v0.0.0-20190430073000-30950c05d534
# 'get -u' should not downgrade to the chronologically older tagged version.
go get -d -u
go list -m -u all
stdout '^example.com/pseudoupgrade v0.0.0-20190430073000-30950c05d534$'
# 'get example.com/pseudoupgrade@upgrade should not downgrade.
go get -d example.com/pseudoupgrade@upgrade
go list -m -u all
stdout '^example.com/pseudoupgrade v0.0.0-20190430073000-30950c05d534$'
# 'get example.com/pseudoupgrade' should not downgrade.
go get -d example.com/pseudoupgrade
go list -m -u all
stdout '^example.com/pseudoupgrade v0.0.0-20190430073000-30950c05d534$'
# 'get example.com/pseudoupgrade@latest' should downgrade.
go get -d example.com/pseudoupgrade@latest
go list -m -u all
stdout '^example.com/pseudoupgrade v0.1.0$'
-- go.mod --
module x
go 1.12
-- main.go --
package x
import _ "example.com/pseudoupgrade"