blob: b78e6e644f7622a3d22dd4333672c7f3731dcf48 [file] [log] [blame]
env GO111MODULE=on
env GOPROXY=direct
env GOSUMDB=off
# Testing that a pseudo-version is based on the semantically-latest
# prefixed tag in any commit that is a parent of the commit supplied
# to 'go get', when using a repo with go.mod in a sub directory.
[!net] skip
[!exec:git] skip
# For this test repository go.mod resides in sub/ (only):
# master is not tagged
# tag v0.2.0 is most recent tag before master
# tag sub/v0.0.10 is most recent tag before v0.2.0
# The pseudo-version is based on sub/v0.0.10, since v0.2.0 doesn't
# contain the prefix.
go get -d
go list -m all
stdout '^ v0.0.10$'
go get -d -u
go list -m all
stdout '^ v0.0.11-0\.'
-- go.mod --
module x
go 1.12
-- x.go --
package x
import _ ""
-- --
# This is not part of the test.
# Run this to generate and update the repository on
set -euo pipefail
cd "$(dirname "$0")"
rm -rf prefixtagtests
mkdir prefixtagtests
cd prefixtagtests
git init
mkdir sub
echo module >sub/go.mod
echo package sub >sub/sub.go
git add sub
git commit -m 'create module sub'
for i in v0.1.0 sub/v0.0.9 sub/v0.0.10 v0.2.0; do
echo $i >status
git add status
git commit -m $i
git tag $i
echo 'after last tag' >status
git add status
git commit -m 'after last tag'
zip -r ../ .
gsutil cp ../ gs://vcs-test/git/