-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
Add tools/mod to module_dirs #18590
Add tools/mod to module_dirs #18590
Conversation
e5e43c5
to
d98e743
Compare
Need to rebase on main after #18575 is merged Currently CI will error on
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted filessee 27 files with indirect coverage changes @@ Coverage Diff @@
## main #18590 +/- ##
==========================================
- Coverage 68.83% 68.76% -0.08%
==========================================
Files 420 420
Lines 35474 35519 +45
==========================================
+ Hits 24418 24424 +6
- Misses 9636 9669 +33
- Partials 1420 1426 +6 Continue to review full report in Codecov by Sentry.
|
60ed2ae
to
117598a
Compare
/cc @ivanvc |
117598a
to
8dd4a56
Compare
/retest |
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.
Thanks for catching and addressing this, Henry! I left a suggestion, but if we don't want to block the PR, I'm okay with a follow-up to address them.
Let’s make sure this PR is perfect before merging! Doing a follow-up will make the codebase commit history ugly :( |
8dd4a56
to
aa7efbd
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.
LGTM. Thanks, Henry.
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.
LGTM
cc @serathius, @ahrtr in case there is some historical reason why tools/mod
was intentionally excluded that I am not aware of.
Trying to shed more context. We're currently excluding it from Edit: But please chime in, Marek and Benjamin, if this may be problematic. |
tools/mod/doc.go
Outdated
// This would break scripts for unit testing and coverage calculation. However, | ||
// to ensure tools like golangci-lint and go test run normally and perform go mod checks, | ||
// we've added this empty file. |
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.
Can you explain this? Why it would break scripts for unit testing and coverage calculation? also why it has some impact on golangci-lint and go test?
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 definitely @ahrtr!
As you can see, the main issue is
% (cd tools/mod && 'env' 'ETCD_VERIFY=all' 'go' 'test' '-v' '-json' '-p=4' '-short' '-timeout=3m' '--race=false' '--cpu=1' './...')
stderr: go: warning: "./..." matched no packages
stderr: no packages to test
As we don't have any source file in the directory, ./...
will cause the tools to report errors, thus, causing the CI to fail
What do you think? :)
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.
Thanks for the clarification. It seems the reason is the module name go.etcd.io/etcd/tools/v3
is different from the directory name mod
?
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.
Please add this into the comment to avoid any confusion for now.
Also why not to make them consistent to avoid such unnecessary confusing comment? It's OK to resolve it separately.
I might have lost some context. You added the tools/mod into the list, but why BOM wasn't changed? |
aa7efbd
to
c5e4177
Compare
This I actually don't know. @ivanvc do you have some idea? :) |
As `tools/mod` also contains the `go.mod` file. We should add it to the `module_dirs` variable, so that when executing `./scripts/fix.sh`, the proper checks and fixes can be applied. To address the issue of broken unit tests and code coverage due to the directory's lack of Go code, we've introduced a new doc.go file. This file acts as a placeholder, enabling tools like golangci-lint and go test to function correctly. --- Discovered when working on etcd-io#18575 The directories are checked against the following: - Command: `find . -type f -name go.mod -exec dirname {} \;` - Output: ``` ./etcdutl . ./tools/testgrid-analysis ./tools/rw-heatmaps ./tools/mod ./etcdctl ./tests ./server ./api ./client/internal/v2 ./client/v3 ./client/pkg ./pkg ``` Signed-off-by: Chun-Hung Tseng <[email protected]>
c5e4177
to
fc901bd
Compare
It is definitely not straightforward; I hope that with the Go workspace, we can clean up/simplify some of these workflows. I'll break down the execution stack step by step to try to make it clear for everyone.
Therefore, running the BOM update script will not run over any of the |
Thanks @ivanvc for the clarification. So we have a dedicated modules (the modules_exp) for BOM. In that case, can we rename |
I just verified that Edit: Maybe even a more ambitious task would be to break the |
Seems like a good idea, but let's do it separately. Two followups,
When above two followups are done, I am open to do minor refactor as mentioned above #18590 (comment) |
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.
LGTM
Thanks
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahrtr, henrybear327, ivanvc, jmhbnz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Could anyone raise a ticket to track #18590 (comment) before we merge this PR? Thanks |
I opened #18602 to track the rename from @henrybear327, do you want to do the following in this same PR, or should we do it in a follow-up?
Regarding:
@ahrtr, I think due to |
OK. #18607 (comment) |
As
tools/mod
also contains thego.mod
file, we should look into adding it to themodule_dirs
variable, so that when executing./scripts/fix.sh
, the proper checks and fixes can be applied.To address the issue of broken unit tests and code coverage due to
tools/mod
directory's lack of Go code, we've introduced a newdoc.go
file. This file acts as a placeholder, enabling tools likegolangci-lint
andgo test
to function correctly.Discovered when working on #18575, where running
./scripts/fix.sh
missed fixing the go mod file intools/mod
, causing the CI pipeline to fail.Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.