golang/go
View on GitHubcmd/go: mod download modpath@HEAD erroneously resolves to a pseudo-version when HEAD is subsequently tagged
Open
#37,336 opened on Feb 20, 2020
GoCommandNeedsInvestigationhelp wantedmodules
Repository metrics
- Stars
- (133,883 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
What version of Go are you using (go version)?
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env)?
What did you do?
First, I configured git with:
[url "file:///home/manlio/src/go/src/mperillo.test/"]
insteadOf = https://mperillo.test/
in order to test with local module paths.
In a new git repository with only 1 commit:
$ go1.14rc1 clean -modcache
$ GOPRIVATE="*" go1.14rc1 mod download -json mperillo.test/issue.git@HEAD
{
"Path": "mperillo.test/issue.git",
"Version": "v0.0.0-20200220172602-e96c074fea4f",
}
Now I release a version, without a new commit:
$ git tag -a v0.1.0
$ GOPRIVATE="*" go1.14rc1 mod download -json mperillo.test/issue.git@HEAD
{
"Path": "mperillo.test/issue.git",
"Version": "v0.1.1-0.20200220172602-e96c074fea4f",
"Error": "mperillo.test/issue.git@v0.1.1-0.20200220172602-e96c074fea4f: invalid pseudo-version: tag (v0.1.0) found on revision e96c074fea4f is already canonical, so should not be replaced with a pseudo-version derived from that tag",
}
What did you expect to see?
Not sure.
But it is not clear why it fails, and the error message seems a bit confusing. Why is go trying to replace the canonical v0.1.0 if this is the version that it is processing now?
P.S.
The actual module path, as defined in go.mod, is mperillo.test/issue and not mperillo.test/issue.git. Can this be considered a bug?
The .git extension was added to force go to don't try to get https://mperillo.test/issue?go-get=1.