-
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
Indirect dependencies in dependent go modules need to be updated #12999
Comments
We have the same issue in https://github.com/keptn/keptn :( |
We would also like to see this feature. It looks like Renovate used to update indirect dependencies by default, but that was removed in #4650. I don't fully understand the reasoning for why this was done, but it seems like updating indirect dependencies should be an option at the very least. |
With golang
I hope someone will pick this up and make the necessary changes to make this happen. |
@woohgit are you able to create a minimal reproduction for that type of failure? |
Yes probably I'll need to create a module (shared) which uses aws-go-sdk for example. Then create 2 more modules that uses the If you wan't I can create a minimal app with the proper setup to reproduce the issue. |
@woohgit thanks, that would be great. I would really like to get this issue solved, and this might be the root cause |
@rarkins On it. I'm waiting for the first dependency PR to be created by renovatebot and I can show it to you then. |
@rarkins And it happened. There you go: https://github.com/woohgit/renovate-12999/pull/3/files This repo consists of a shared module (which depends on aws-sdk-go) and 2 other consumer modules which depend on the shared. For go 1.17+ the go.sum and go.mod has to contain indirect entries for the shared module but that's not updated with the PR. So if you want to build the consumer1 or consumer2 using this PR you'll get the error:
It think at least it should be a config option to update it everywhere (and run go mod tidy in all relevant directories) and maybe set it to |
@rarkins Any comment / update / more help needed etc? |
@woohgit thanks for your updates to the issue. Previously |
Actually everyone is reporting the same as me: Look at the original description of this issue: eriksw/renovate-peer-go-mod-indirect#1 This is exactly the same setup as I presented to you. It's not that we need to run go mod tidy multiple times in the same directory. It's that the |
Actually we have a few Go tidying issues which seem to be bugs, some pre-dating 1.17. I thought we may have found the root cause but it seems not. As discussed above, this will require Renovate to build a dependency tree of related go.mod files, which wasn't necessary before. Classification as a feature request instead of bug was correct in this case. |
@rarkins It's fine! I know it's getting a bit more complex with 1.17. I hope you guys can figure it out quickly how to do it :) |
Whoever implements this will need to decide whether the go.mod dependency tree should be built during the extract phase (extractAllPackageFiles) or instead can be determined dynamically during this artifacts updating stage. |
there is currently ongoing work for nuget, where we need to detect dependent projects. i think we can refactor and reuse some of the code from that PR so solve this issue afterwards. |
This comment was marked as off-topic.
This comment was marked as off-topic.
A simple solution for this issue might be to provide an option that just runs |
This comment was marked as resolved.
This comment was marked as resolved.
I'm open to work on a fix for this! The easiest way I see to implement this is to run Does that would save everyone use case? I'm currently running the following command locally to patch renovate PRs: for i in $(find . -name go.mod); do cd $(dirname "$i") && go mod tidy && cd -; done && git commit -am "chore: go mod tidy in every go modules" && git push However, it is a pain to do that inside every PR. I was thinking about adding an option to renovate to implement a similar behavior, for example a
renovate/lib/modules/manager/gomod/artifacts.ts Lines 307 to 337 in 9669ba3
Is there a package where we could implement "repository wide" operations? |
Check out https://github.com/renovatebot/renovate/blob/main/lib/modules/manager/nuget/package-tree.ts#L16 for an example of how nuget does it |
I would love to see a |
What would you like Renovate to be able to do?
Because go modules include indirect dependencies in the
go.mod
andgo.sum
, when Renovate updates a go module, it also needs to update dependent modules.Scenario:
When renovate updates
monorepo/a/...
it needs to also updatemonorepo/go/b/go.*
at the same time, in the same commit.Because renovate currently does not do this, the PR to update module a fails because we have a test that ensures our module files are always tidy. That fails because when the test runs
go mod tidy
in b, it is stale and updated/rewritten by thego mod tidy
invocation in b, which updates b's indirect dependencies in go.mod and go.sum.Reproduction repo/PR: eriksw/renovate-peer-go-mod-indirect#1
Log:
If you have any ideas on how this should be implemented, please tell us here.
Renovate needs to be aware of relative path replace directives amongst go modules and ensure update/tidy actions propagate following those relationships.
Is this a feature you are interested in implementing yourself?
No
The text was updated successfully, but these errors were encountered: