...
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
9env 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.
14cp go.mod go.mod.orig
15go get -x vcs-test.golang.org/git/issue47650.git/cmd/issue47650@21535ef346c3
16stderr '^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.
21go clean -modcache
22cp go.mod.orig go.mod
23go get -x vcs-test.golang.org/git/issue47650.git/cmd/issue47650@v0.1.1-0.20210811175200-21535ef346c3
24stderr '^go: added vcs-test.golang.org/git/issue47650.git v0.1.1-0.20210811175200-21535ef346c3$'
25
26-- go.mod --
27module example
28
29go 1.20
View as plain text