-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
Minimal changes to enable a Go workspace #19423
base: main
Are you sure you want to change the base?
Conversation
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ivanvc The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted filessee 24 files with indirect coverage changes @@ Coverage Diff @@
## main #19423 +/- ##
==========================================
+ Coverage 68.81% 68.87% +0.05%
==========================================
Files 421 421
Lines 35901 35901
==========================================
+ Hits 24705 24726 +21
+ Misses 9770 9745 -25
- Partials 1426 1430 +4 Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
/test all |
d555146
to
b7e86a4
Compare
b7e86a4
to
eb81e5b
Compare
/cc @ahrtr @serathius |
@@ -14,7 +14,7 @@ function bom_fixlet { | |||
# shellcheck disable=SC2207 | |||
modules=($(modules_for_bom)) | |||
|
|||
if GOFLAGS=-mod=mod run_go_tool "github.com/appscodelabs/license-bill-of-materials" \ |
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.
GOFLAGS=-mod=mod
is this even a correct flag? Could we remove it regardless of workspace migration?
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.
Yes, I think so. This should predate Go 1.1113.
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.
Ah, never mind. Actually, I believe, due to the note in bom_pass
, we may need to leave the -mod=mod
flag in the tests. But you're right. There's no need for it to be here, as test_lib.sh
doesn't define a GOFLAGS=-mod
that we need to override. I'll open a pull request for this change.
I will review this PR after we officially release v3.6.0, thx |
Introduce a new Go workspace that references all the current submodules. To preserve the current behavior, point all of the current FORBIDDEN_DEPENCENCY virtual dependencies to the same path. Add scripts/update_go_workspace.sh that generates the Go workspace file (go.work) based on the submodules found in the project and creates the go.work.sum file after running go mod download. Added this script to the fix Makefile target. Even though, the number of modules in the etcd repository is small, by adding an automated way of updating the go.work modules future proofs the project in case there are new modules or removal of them. Point all forbidden dependencies to a common virtual place (top-level FORBIDDEN_DEPENDENCY). For the workspace to function we need all dependencies to be consistent across the repository. That means that the current approach with FORBIDDEN_DEPENDENCY doesn't work, because they are pointing to different directories. Set the fictional v3.999.999 version for these dependencies, so they are consitent, and they don't clash with the actual depdendencies references in other modules. Co-authored-by: Tim Hockin <thockin@google.com> Signed-off-by: Ivan Valdes <ivan@vald.es>
Introduce a new `verify-go-workspace` make target executed by the `verify` target. The pull-etcd-verify presubmit prow job will execute it. It ensures that the Go workspace (`go.work` and `go.work.sum`) is in sync. Signed-off-by: Ivan Valdes <ivan@vald.es>
Add checking for the Go toolchain directive in the go.work file too. Signed-off-by: Ivan Valdes <ivan@vald.es>
eb81e5b
to
9ed8ecc
Compare
Remove `GOFLAGS=-mod=mod` from the execution of license-bill-of-materials. Signed-off-by: Ivan Valdes <ivan@vald.es>
9ed8ecc
to
d3c2c0b
Compare
This pull request is a follow-up on #19314.
It introduces minimal changes to enable a workspace in the project. We can iterate on it later to remove the script nuances of looping over the modules to execute commands, as they can now be executed from the top level of the repository.
Part of #18409.
Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.