Skip to content

#1074: Add imports of previous root package in new subpackages to avoid dependency upgrade issues.#1075

Merged
valerian-roche merged 3 commits intomainfrom
vr/import-deps-fix
Jan 3, 2025
Merged

#1074: Add imports of previous root package in new subpackages to avoid dependency upgrade issues.#1075
valerian-roche merged 3 commits intomainfrom
vr/import-deps-fix

Conversation

@valerian-roche
Copy link
Copy Markdown
Contributor

The module split seems to be breaking when the get -u command is used.
Using the link referred in this post, this change attempts to address the issue.

While I was able to test this change within one of our repository depending on this repository (for go-control-plane and envoy API), I do not know of a way to guarantee that this will resolve all cases.

Fixes #1074

mmorel-35
mmorel-35 previously approved these changes Dec 24, 2024
@valerian-roche
Copy link
Copy Markdown
Contributor Author

Also added a fix to ./ci/sync_envoy.sh to avoid the workflow removing the submodule files

contrib/go.mod Outdated
module github.com/envoyproxy/go-control-plane/contrib

go 1.21
go 1.22.8
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it would be great if the go.mod version can remain the same for this fix.

Copy link
Copy Markdown
Contributor Author

@valerian-roche valerian-roche Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version is automatically updated due to the added dependency on the root-level go.mod which has been using 1.22.8 for some time.
If a blocker I can see to rollback this change but it is not, per se, part of the module split, as the new version of the main module would have also changed this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a separate PR we removed the dependency on the minor to now only depend on go 1.22, aligning with grpc-go required version.

envoy/go.mod Outdated
go 1.22.8

// Used to resolve import issues related to go-control-plane package split (https://github.com/envoyproxy/go-control-plane/issues/1074)
replace github.com/envoyproxy/go-control-plane@v0.13.2 => ../
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for pinning the version here but not in the go.mod files for examples/dyplomat and ratelimit packages?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those packages inherit it through the envoy submodule, and therefore don't require it directly

Valerian Roche added 2 commits January 2, 2025 20:59
…ndency upgrade issues.

Those changes are based on https://go.dev/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository

Fixes #1074

Signed-off-by: Valerian Roche <valerian.roche@datadoghq.com>
…ure envoy API sync does not purge files it should not

Signed-off-by: Valerian Roche <valerian.roche@datadoghq.com>
Signed-off-by: Valerian Roche <valerian.roche@datadoghq.com>
Copy link
Copy Markdown

@codyoss codyoss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a nit otherwise LGTM. I'm a maintainer from the google-cloud-go project affected by this issue. Thanks for the fix.

go 1.22

// Used to resolve import issues related to go-control-plane package split (https://github.com/envoyproxy/go-control-plane/issues/1074)
replace github.com/envoyproxy/go-control-plane@v0.13.3 => ../
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: unless you need this for your project replace statements don't do anything for downstream users. So if you don't need this it can be removed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review. I took this from https://go.dev/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository, where they explicitly state this replace as a way to avoid the "ambiguous" import.
I do not have enough understanding of go.mod resolution logic to know if this actually helps or not

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the section you are referring to is:

cd path-to/github.com/my-repo/mig
go mod edit -replace github.com/my-repo@v1.3.0=../
go test ./...
go mod edit -dropreplace github.com/my-repo@v1.3.0

If so this is meant to be a temporary test, as you can see be the drop command after. This is because it assumes the module is not yet published that you are referencing. In this case though the version where this module has been carved out already exists.

This causes no harm either way though, just thought I would share :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. I think I get it better now, and they cut tag out of the intermediate commit with the replace. In order to keep it simpler to track I'll do this in two PRs. I'll create a new one to drop the replace

@valerian-roche valerian-roche merged commit 90c18a6 into main Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v0.13.2 broke dependency upgrades for cloud.google.com/go/storage

4 participants