Renovate: Go modules: update source code after major updates

Created on 11 Mar 2019  路  5Comments  路  Source: renovatebot/renovate

What would you like Renovate to be able to do?

Update Go's import references after major updates

Describe the solution you'd like

Whenever doing a major update in go.mod, Renovate should find and update all "old" references from within source code, e.g.

image

I'm not sure yet about exactly what logic Renovate should use or if it's as simple as a global grep/search/replace through *.go files.

Describe alternatives you've considered

Otherwise users need to add these changes themselves to a PR.

Additional context

This is an example PR from Renovate today: https://github.com/hairyhenderson/github-responder/pull/82

Here is a manual/human PR that replaced it: https://github.com/hairyhenderson/github-responder/pull/90 (Cc @hairyhenderson)

Something also strange is that the replacement PR has vendored modules updated while Renovate's did not. I'm suspecting it could be related to Renovate's failure to update the references in source code, but not 100% sure.

help wanted gomod priority-3-normal feature

Most helpful comment

Here is a tool that does exactly what you need
https://github.com/marwan-at-work/mod

All 5 comments

I checked this manually and verified that go mod vendor indeed works as expected only once the import statements are updated. Example command I used: find *.go -type f -print0 | xargs -0 sed -i '' 's/"github.com\/google\/go-github\/v20\(\/\)/"github.com\/google\/go-github\/v24\1/g'

I'm not sure yet about exactly what logic Renovate should use or if it's as simple as a global grep/search/replace through *.go files.

That's probably enough IMO - if there are incompatibilities, the code won't compile, and that should be obvious through CI.

Thanks, I think so too. So once this is implemented you would see the exact same PR that you generated by hand, including vendored modules. In cases where the breaking changes break your code, you hopefully see that either by a build error or tests breakage, but either way you should know to check major updates carefully before merging :)

Thanks @rarkins! 馃槵

Here is a tool that does exactly what you need
https://github.com/marwan-at-work/mod

Was this page helpful?
0 / 5 - 0 ratings