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 [!git] skip
7
8 env GOPRIVATE=vcs-test.golang.org
9
10 # If we request a package in a subdirectory of a module by commit hash, we
11 # successfully resolve it to a pseudo-version derived from a tag on the parent
12 # commit.
13 cp go.mod go.mod.orig
14 go get -x vcs-test.golang.org/git/issue47650.git/cmd/issue47650@21535ef346c3
15 stderr '^go: added vcs-test.golang.org/git/issue47650.git v0.1.1-0.20210811175200-21535ef346c3$'
16
17 # Explicitly requesting that same version should succeed, fetching additional
18 # history for the requested commit as needed in order to validate the
19 # pseudo-version base.
20 go clean -modcache
21 cp go.mod.orig go.mod
22 go get -x vcs-test.golang.org/git/issue47650.git/cmd/issue47650@v0.1.1-0.20210811175200-21535ef346c3
23 stderr '^go: added vcs-test.golang.org/git/issue47650.git v0.1.1-0.20210811175200-21535ef346c3$'
24
25 -- go.mod --
26 module example
27
28 go 1.20
29
View as plain text