So if there is a CLI tool implemented in Go (e.g., github.com/example/tool/cmd/tool) which I fork into my namespace and slightly fix (e.g., github.com/mitar/tool/cmd/tool), there seems to be no way to currently do go install github.com/mitar/tool/cmd/tool@latest to get my fork installed locally without doing find/replace over all files to change original package name to my fork's.
I would propose that there is such a way, maybe by providing a replace directive using CLI argument while installing, e.g.:
go install -replace gogithub.com/example/tool=github.com/mitar/tool@main github.com/example/tool/cmd/tool@latest
This is to support a common use case of collaboration in open source projects:
I fork the project.
I make a fix.
I make a PR to the main project.
While the main project is reviewing my PR I want to use the fixed CLI tool, e.g., in the Dockerfile which originally had go install with the original project.
After PR is merged, I start using go install from original location again.
Currently I have to do the PR and then in another branch make one more commit on top of the PR, doing find/replace to replace module paths in all the codebase. This is tedious and error prone if during the review of PR I am asked to do modifications. Then I have to do the fix and then re-do the module paths replacements in a new commit.
The text was updated successfully, but these errors were encountered: