Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: cmd/go: allow "go install" a forked repository with cmd #50278

Open
mitar opened this issue Dec 20, 2021 · 0 comments
Open

proposal: cmd/go: allow "go install" a forked repository with cmd #50278

mitar opened this issue Dec 20, 2021 · 0 comments
Labels
Projects
Milestone

Comments

@mitar
Copy link

@mitar mitar commented Dec 20, 2021

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.

@mitar mitar added the Proposal label Dec 20, 2021
@gopherbot gopherbot added this to the Proposal milestone Dec 20, 2021
@ianlancetaylor ianlancetaylor added this to Incoming in Proposals Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Proposals
Incoming
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants