-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Go Modules: update import paths after major upgrades #3627
Comments
IIUC, without this, major upgrades to v2+ are completely broken for Golang in Renovate if the code has explicitly included version numbers in import paths. e.g. our codebase has Renovate creates this PR for us: web-platform-tests/wpt.fyi#1550 which does not work at all. Running |
Renovate does not support rewriting import paths yet. Simply changing `go.mod` is pointless. renovatebot/renovate#3627 Also disable auto merge because Renovate can't auto merge when there is branch protection (required review) in place.
Renovate does not support rewriting import paths yet. Simply changing `go.mod` is pointless. renovatebot/renovate#3627 Also disable auto merge because Renovate can't auto merge when there is branch protection (required review) in place.
@Hexcles are you aware of any existing tools/commands that could achieve this today as a post install step? Or fool-proof logic for updating .go files that Renovate could implement natively? Of course the next challenge is that even with updated import paths, you’re probably still “broken” due to breaking change itself. |
I tried I think the right thing to do here is to accept the fact that we can't automatically upgrade major versions for Go modules yet and stop creating those no-op PRs that only touch |
FWIW, Dependabot has the same limitation: https://dependabot.com/blog/go-modules-alpha/ |
@Hexcles you can disable major updates for go modules this way in config: "gomod": {
"major": {
"enabled": false
}
} Although I suggest instead putting them behind an approval step so they're not completely "out of sight out of mind". "masterIssue": true,
"gomod": {
"major": {
"masterIssueApproval": true
}
} The PRs currently aren't "no-op" in the sense that they do update the And it goes without saying that the second there's a third party tool that can update the imports, or a foolproof way we can do it ourselves, then we can add it. Unlike Dependabot, we operate on a shallow clone of repos so we already can do things like |
I have seen this case when renovate did upgrade from Something like this will update all import paths to
But i agree that manual intervention still recommended since that way of versioning was to clearly say that it is a major release and won't / may not be a backward-compatible especially if there no proper automated testing. |
Duplicate of #3348 |
Suggestion:
@rarkins But there is a section about updating dependencies; see https://github.com/marwan-at-work/mod#upgrading-a-dependency . Also according to official go mod docs you are supposed to update your import paths when increasing major version (from v2 and onward, see https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher) and renovate doesn't cover this currently. Renovate fails to upgrade for example caarlos0/env because of missing major version in imports, see caarlos0/env#86. marwan-at-work/mod seems to be a nice fit to automatically fix the import paths for major versions updates. Not sure whether it fixes also this issue but given it is a recommended tool by official documentation I would expect it to work correctly.
Originally posted by @rkuska in #3557 (comment)
The text was updated successfully, but these errors were encountered: