1 # Regression test for https://go.dev/issue/47650:
2 # 'go get' with a pseudo-version of a non-root package within a module
3 # erroneously rejected the pseudo-version as invalid, because it did not fetch
4 # enough commit history to validate the pseudo-version base.
5
6 [short] skip 'creates and uses a git repository'
7 [!git] skip
8
9 env GOPRIVATE=vcs-test.golang.org
10
11 # If we request a package in a subdirectory of a module by commit hash, we
12 # successfully resolve it to a pseudo-version derived from a tag on the parent
13 # commit.
14 cp go.mod go.mod.orig
15 go get -x vcs-test.golang.org/git/issue47650.git/cmd/issue47650@21535ef346c3
16 stderr '^go: added vcs-test.golang.org/git/issue47650.git v0.1.1-0.20210811175200-21535ef346c3$'
17
18 # Explicitly requesting that same version should succeed, fetching additional
19 # history for the requested commit as needed in order to validate the
20 # pseudo-version base.
21 go clean -modcache
22 cp go.mod.orig go.mod
23 go get -x vcs-test.golang.org/git/issue47650.git/cmd/issue47650@v0.1.1-0.20210811175200-21535ef346c3
24 stderr '^go: added vcs-test.golang.org/git/issue47650.git v0.1.1-0.20210811175200-21535ef346c3$'
25
26 -- go.mod --
27 module example
28
29 go 1.20
30
View as plain text