-
Notifications
You must be signed in to change notification settings - Fork 4.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
build: Adopt go.work and remove submodule replace statements #21657
Conversation
4f92790
to
81c472f
Compare
1f5b986
to
62fa078
Compare
NTS: we might need to double-run |
54c357d
to
2c91ec1
Compare
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
1 similar comment
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
f54702c
to
9e9d0e1
Compare
) | ||
|
||
require ( | ||
cel.dev/expr v0.15.0 // indirect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This came from the upgrade of github.com/cncf/xds/go
below
❯ go mod why -m cel.dev/expr
# cel.dev/expr
github.com/hashicorp/consul/agent/envoyextensions/builtin/aws-lambda
github.com/envoyproxy/go-control-plane/envoy/config/listener/v3
github.com/cncf/xds/go/xds/type/matcher/v3
github.com/cncf/xds/go/xds/type/v3
cel.dev/expr
golang.org/x/sys v0.19.0 // indirect | ||
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect | ||
github.com/rogpeppe/go-internal v1.11.0 // indirect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This came from the kr/pretty
dependency of hashicorp/hcl
used by consul/internal/protohcl
❯ go mod why -m github.com/rogpeppe/go-internal
# github.com/rogpeppe/go-internal
github.com/hashicorp/consul/internal/protohcl
github.com/hashicorp/hcl/v2/hclparse
github.com/hashicorp/hcl/v2/hclsyntax
github.com/hashicorp/hcl/v2/hclsyntax.test
github.com/kr/pretty
github.com/rogpeppe/go-internal/fmtsort
RUN go build -v -o test-sds-server sds.go | ||
RUN go build -v -o test-sds-server ./... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required to vendor grpr.go
(GRPCLogger
) in test-sds-server
to remove consul
dependency and build all code.
//TODO Note that the reuse of `decode` here is the entire reason why `consul` is | ||
// required as a module. In the future, we should consider moving this code | ||
// to a separate shared module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😐
9e9d0e1
to
c521ce1
Compare
github.com/envoyproxy/protoc-gen-validate v1.0.2 // indirect | ||
github.com/go-logr/logr v1.3.0 // indirect | ||
github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect | ||
github.com/felixge/httpsnoop v1.0.4 // indirect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a metrics lib used by otel
toolchain go1.22.5 | ||
toolchain go1.22.7 | ||
|
||
replace github.com/hashicorp/consul => ../../.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See note here: https://github.com/hashicorp/consul/pull/21657/files#r1806775582
consul
brought in tencentcloud
dependencies that conflicted w/ an incompatible new v1 module w/ a new path (see this issue). Using a path replace of consul
here should be fine since this isn't a public submodule, is only used for tests, and doesn't impact releases.
Ironically, I think that a new tag of this PR's version of the root go.mod
(w/ upgraded tencentcloud
deps) would allow us to un-replace this.
Tagging a few folks who may have interest for review. |
c521ce1
to
6d9a4d5
Compare
6d9a4d5
to
61928c5
Compare
- add go.work and synchronize go.mod files - add go work sync check to CI and Makefile - remove replace statements (replaced by go.work) - fix tencentcloud ambiguous import by removing consul from test-sds-server and consul-container dependencies and upgrading go-discover - fix security scan by cloning scanner outside consul repo - fix broken otel exporter due to metrics upgrade - upgrade otel further to fix library compatibility with itself which borrows its decode package - fix consul-container lint for deprecated gRPC methods - fix test-sds-server Dockerfile - proto-gen following protoc bump to swap interface for any
61928c5
to
ef45ea8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to see if this is committed accidentally.
Closing this PR due to priority. |
ACK. Thank you for reviewing while I was on leave! |
Description
Adopt
go.work
and make supporting changes to synchronize dependencies across locally-replaced modules.This provides several advantages:
replace
statements can be removed from individualgo.mod
filesreplace
in order to ensurego.sum
contains entries for any locally-replaced module paths.x
) git historygo get ...@latest
/@upgrade
won't produce extremely old-looking pseudo-versions when importing SHAsConsiderations
I think this change warrants some consideration before merging! Here's some factors that we should weigh in our decision vs. the benefits noted above:
go.work
in CI, given that we usereplace
widely today for the same effect (using local code rather than published submodule tags), and we are not usinggo.work
here to replace non-local dependencies.api
,sdk
,proto-public
,envoyextensions
,troubleshoot
).go.work
file, which led to the warning above. IMO, we fall into the "monorepo w/ submodules" case, and by forcinggo work sync
in CI, we can sidestep the unexpected pitfalls that can come w/ the overriding power ofgo.work
. Also, we aren't explicitly setting any versions in ours - just controlling replace statements.go.work
. Less relevant to our use cases, but notable.main
and make a final call closer to 1.21 LTS.Change list
Because this involved synchronizing previously drifted dependencies, some additional changes were forced on this PR.
The full list of changes required to make this happen included:
go.work
and synchronizego.mod
filesgo work sync
check to CI and Makefilereplace
statements (replaced bygo.work
)tencentcloud
ambiguous import by removingconsul
fromtest-sds-server
andconsul-container
dependencies and upgradinggo-discover
consul
repowhich borrows its decode package
consul-container
lint for deprecated gRPC methodstest-sds-server
Dockerfileproto-gen
following protoc bump to swapinterface{}
forany
Backport notes
I think it would be ideal if we backported the core
go.work
changes to our active release branches. This would make backports of futurego.mod
andgo.work
changes simpler. The cost of doing this is potentially repeating several of the steps noted above by hand, since the finalgo.mod
andgo.sum
for earlier versions ofconsul
will require a difference set of dependencies. The alternative is keeping this change limited tomain
, and waiting until 1.21 to get the desired impact on submodule releases.Regardless, I think it's valuable to first kick the tires on this change a bit before backporting, and see 1) how well it handles dependency bumps and 2) how much/what sort of impact it has on backports.
Any reviewer feedback on this is welcome, and while I'm on PTO, please feel free to pick this PR up and run with it.
Post-merge followups
replace
statement shuffle and related notes about orphan commits, replacing with instructions to tag submodules directly from the.x
release branch after dependency updates are madego.work
toolchain directive rather than.go-version
for selecting the Go version for buildsPR Checklist