You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if this is a bug but if not I'd like to understand the reasoning.
We have an open-source cmd-line tool with several releases but we created a dedicated Github organization and transferred the repository to it. We planned to update the module name, all import paths and documentation to the new URL.
Then the problem is that:
# old module name
go install github.com/mineiros-io/terramate/cmd/[email protected]
works fine but using the new module name it fails:
$ go install github.com/terramate-io/terramate/cmd/[email protected]
go: github.com/terramate-io/terramate/cmd/[email protected]: github.com/terramate-io/[email protected]: parsing go.mod:
module declares its path as: github.com/mineiros-io/terramate
but was required as: github.com/terramate-io/terramate
GitHub is now redirecting requests from the old repo to the new one, then installing with the old repo still works, but if explicitly using the new name/url then it fails...
And if manually downloading the zip from the proxy, unzipping and then everything works (go install, go build, go test, etc).
So it looks like go install is very picky and disallows the installation if the requested module is different than the one obtained from the released modfile.
Why?
EDIT: I identified the only check that prevents this from working
I just compiled Go from sources and removed this if below and then the install works:
I'd like to know if the comment above the if applies to this case as well (GitHub redirection).
What did you expect to see?
The go install invocations using the new module name should be able to install releases created with the old module name.
What did you see instead?
The go install cannot install releases created before a repository was transferred using the new module name.
The text was updated successfully, but these errors were encountered:
i4ki
changed the title
cmd/go: install fails when installing releases of transferred repositories.
cmd/go: install fails when installing old releases of transferred repositories.
May 26, 2023
i4ki
changed the title
cmd/go: install fails when installing old releases of transferred repositories.
cmd/go: install fails when installing old releases of GH transferred repositories.
May 26, 2023
It's not a duplicate... This is not a case of forking a repository.
The proposed solution there involves a -replace option which does not make any sense here, as the old repository doesn't exist anymore.
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
)?go env
OutputWhat did you do?
I'm not sure if this is a bug but if not I'd like to understand the reasoning.
We have an open-source cmd-line tool with several releases but we created a dedicated Github organization and transferred the repository to it. We planned to update the module name, all import paths and documentation to the new URL.
Then the problem is that:
works fine but using the new module name it fails:
GitHub is now redirecting requests from the old repo to the new one, then installing with the old repo still works, but if explicitly using the new name/url then it fails...
In the Go proxy, the new module name can reach all releases created with the old name: https://proxy.golang.org/github.com/terramate-io/terramate/@v/v0.2.18.mod
(Check the module declaration)
And if manually downloading the zip from the proxy, unzipping and then everything works (go install, go build, go test, etc).
So it looks like
go install
is very picky and disallows the installation if the requested module is different than the one obtained from the released modfile.Why?
EDIT: I identified the only check that prevents this from working
I just compiled Go from sources and removed this
if
below and then the install works:go/src/cmd/go/internal/modload/modfile.go
Lines 634 to 645 in 055c186
I'd like to know if the comment above the
if
applies to this case as well (GitHub redirection).What did you expect to see?
The
go install
invocations using the new module name should be able to install releases created with the old module name.What did you see instead?
The
go install
cannot install releases created before a repository was transferred using the new module name.The text was updated successfully, but these errors were encountered: