1 env GOPROXY=direct
2 env GOSUMDB=off
3
4 # Testing that a pseudo-version is based on the semantically-latest
5 # prefixed tag in any commit that is a parent of the commit supplied
6 # to 'go get', when using a repo with go.mod in a sub directory.
7
8 [!git] skip
9
10 # For this test repository go.mod resides in sub/ (only):
11 # master is not tagged
12 # tag v0.2.0 is most recent tag before master
13 # tag sub/v0.0.10 is most recent tag before v0.2.0
14 #
15 # The pseudo-version is based on sub/v0.0.10, since v0.2.0 doesn't
16 # contain the prefix.
17 go get vcs-test.golang.org/git/prefixtagtests.git/sub
18 go list -m all
19 stdout '^vcs-test.golang.org/git/prefixtagtests.git/sub v0.0.10$'
20
21 go get -u vcs-test.golang.org/git/prefixtagtests.git/sub@master
22 go list -m all
23 stdout '^vcs-test.golang.org/git/prefixtagtests.git/sub v0.0.11-0\.'
24
25 -- go.mod --
26 module x
27
28 go 1.12
29 -- x.go --
30 package x
31
32 import _ "vcs-test.golang.org/prefixtagtests.git/sub"
33 -- gen_prefixtagtests.sh --
34 #!/bin/bash
35
36 # This is not part of the test.
37 # Run this to generate and update the repository on vcs-test.golang.org.
38
39 set -euo pipefail
40 cd "$(dirname "$0")"
41 rm -rf prefixtagtests
42 mkdir prefixtagtests
43 cd prefixtagtests
44
45 git init
46 mkdir sub
47 echo module vcs-test.golang.org/git/prefixtagtests.git/sub >sub/go.mod
48 echo package sub >sub/sub.go
49 git add sub
50 git commit -m 'create module sub'
51 for i in v0.1.0 sub/v0.0.9 sub/v0.0.10 v0.2.0; do
52 echo $i >status
53 git add status
54 git commit -m $i
55 git tag $i
56 done
57 echo 'after last tag' >status
58 git add status
59 git commit -m 'after last tag'
60
61 zip -r ../prefixtagtests.zip .
62 gcloud storage cp ../prefixtagtests.zip gs://vcs-test/git/prefixtagtests.zip
63
View as plain text