-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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 get -u' to upgrade the targets of replacements #32721
Comments
That's not enough information for us to reproduce this error, let alone to verify a fix for it. Please provide complete steps to reproduce the problem. |
@bcmills ok, simple files main.go
faker/app.go
go.mod
just create these files, then run if syreclabs.com/go/faker updates, i want to keep up, i will run now go.mod became
what i expected is go.mod
let me know if there is anything unclear .... thanks |
This seems closely related to #28176, in that both want to track updates in replacements. But note that the argument to If/when we go support path replacements (as in #26904) instead of source code replacements, then you could do something like:
And then |
This is a feature request or proposal, i'll change the title first ... |
I think it would be a mistake to do this. |
@rsc if it is a mistake to do go mod replacement. why go mod edit --replace exists ? there are scenarios when you want to update right-hand-sides. eg. a real example from me: i'm forking this repo to do my work, this relies on qor/auth, but there is bug on qor/auth. i forked it. and use go mod edit --replace to redirect to forked one. everytime i update the forked qor/auth, i have to go get and the edit go.mod. btw, forks will not merged because no active maintaining on this repo. i heard google use a monorepo so this feature may not be very useful. it was hard for forking go code and pull request because of the path, now it's better thanks to go mod edit --replace, why not make it better ?
no-replace as default behavior, just add --replace flag ? if you want to the right-hand-sides, just |
FWIW, we had to write a custom tool ( It is still far from perfect since now developers have to remember to run |
/cc (&ping) @bcmills @jayconrod |
I think we should see where we land with #26904, and possibly revisit this proposal at that point. (We need a more solid foundation for |
I just hit this as well.
I'm not so sure. Experimenting with and then maintaining ongoing private patches atop public repos is commonplace. (This is for a variety of reasons: abandoned repos, slow upstream review times, slow upstream release cycles, patch is not appropriate to upstream.) Thus using replace is also commonplace. It seems that "opting out of all the usual logic" means in practice "lacking tooling to accomplish basic tasks". And lacking tooling to accomplish basic tasks in commonplace usage is not ideal. It's worth saying: Maybe I'm not holding it right. I'm honestly still really struggling to figure out how to make modules play nicely with all the different stages of hacking on public code. Maybe #33848 would change things. I'm not sure. |
@josharian, I would generally expect a long-running, actively-maintained fork to have its own import path and its own separate versioning. For example, if your fork and the upstream module both start out at Since the versions can't necessarily remain in lock-step anyway, #26904 seems like a more appropriate solution. |
@bcmills, like @josharian said there are many reasons we may want to use replacement feature. you mean the appropriate solution is "rewrite the import path" ? |
The last comment was over a year ago, and things have changed. What is the status of this idea? Is this still relevant? Thanks. |
I still think that #26904 is the appropriate solution for this use-case, and I'm hoping to get to in this cycle (it's been over a year, but a long one 😅). |
From a user’s point of view, this is definitely still relevant and an ongoing source of frustration. Not two weeks ago I wrote a script that calls uses dropreplace, calls go get -u, and restores the replace directive. |
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?
go get -u github.com/dfang/auth
What did you expect to see?
just update/replace the hash with updated one in go.mod
What did you see instead?
the hash didn't change, but add one dependency on
for now i have to copy hash in
require
, delete the line, update the hash inreplace
The text was updated successfully, but these errors were encountered: