Skip to content
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

[3.5] Fix dependency inconsistency detection and add make verify-dep #18207

Merged
merged 4 commits into from
Jun 20, 2024

Conversation

henrybear327
Copy link
Contributor

Makefile's target verify-dep current behavior is to use go list to check consistent dependency versions from direct dependencies. Ignoring indirect dependencies in a multi-module project could lead to version mismatches. If module A imports module B, module B's dependency will be an indirect dependency in module A. Which can potentially have a version mismatch. Therefore, use go mod edit with indirect dependencies, too. So it can work with all dependencies defined in go.mod.

Fix displaying dependencies with mismatches, as the old code was searching with grep just for the prefix, which would show other dependencies that shared the same prefix.

Reference:

Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.

@henrybear327
Copy link
Contributor Author

/cc @ivanvc

@k8s-ci-robot k8s-ci-robot requested a review from ivanvc June 19, 2024 21:23
Makefile's target `verify-dep` current behavior is to use `go list` to
check consistent dependency versions from direct dependencies. Ignoring
indirect dependencies in a multi-module project could lead to version
mismatches. If module A imports module B, module B's dependency will be
an indirect dependency in module A. Which can potentially have a version
mismatch. Therefore, use `go mod edit` with indirect dependencies, too.
So it can work with all dependencies defined in go.mod.

Fix displaying dependencies with mismatches, as the old code was
searching with grep just for the prefix, which would show other
dependencies that shared the same prefix.

Reference:
- etcd-io#18205

Signed-off-by: Ivan Valdes <ivan@vald.es>
Signed-off-by: Chun-Hung Tseng <henrybear327@gmail.com>
@henrybear327
Copy link
Contributor Author

henrybear327 commented Jun 19, 2024

Discovered several inconsistencies

FAIL: inconsistent versions for depencency: github.com/google/go-cmp
  - github.com/google/go-cmp@v0.5.9 (indirect) from: go.etcd.io/etcd/raft/v3
  - github.com/google/go-cmp@v0.6.0 from: go.etcd.io/etcd/server/v3
FAIL: inconsistent versions for depencency: github.com/modern-go/concurrent
  - github.com/modern-go/concurrent@v0.0.0-20180228061459-e0a[39](https://github.com/etcd-io/etcd/actions/runs/9588317478/job/26440100590?pr=18207#step:5:40)a4cb421 (indirect) from: go.etcd.io/etcd/client/v2
  - github.com/modern-go/concurrent@v0.0.0-20180306012644-bacd9c7ef1dd (indirect) from: go.etcd.io/etcd/etcdctl/v3
  - github.com/modern-go/concurrent@v0.0.0-20180306012644-bacd9c7ef1dd (indirect) from: go.etcd.io/etcd/etcdutl/v3
  - github.com/modern-go/concurrent@v0.0.0-20180306012644-bacd9c7ef1dd (indirect) from: go.etcd.io/etcd/server/v3
  - github.com/modern-go/concurrent@v0.0.0-20180306012644-bacd9c7ef1dd (indirect) from: go.etcd.io/etcd/tests/v3
  - github.com/modern-go/concurrent@v0.0.0-20180306012644-bacd9c7ef1dd (indirect) from: go.etcd.io/etcd/v3
FAIL: inconsistent versions for depencency: golang.org/x/sys
  - golang.org/x/sys@v0.0.0-202204122112[40](https://github.com/etcd-io/etcd/actions/runs/9588317478/job/26440100590?pr=18207#step:5:41)-33da011f77ad from: go.etcd.io/etcd/client/pkg/v3
  - golang.org/x/sys@v0.18.0 (indirect) from: go.etcd.io/etcd/api/v3
  - golang.org/x/sys@v0.18.0 (indirect) from: go.etcd.io/etcd/client/v3
  - golang.org/x/sys@v0.18.0 (indirect) from: go.etcd.io/etcd/etcdctl/v3
  - golang.org/x/sys@v0.18.0 (indirect) from: go.etcd.io/etcd/etcdutl/v3
  - golang.org/x/sys@v0.18.0 (indirect) from: go.etcd.io/etcd/pkg/v3
  - golang.org/x/sys@v0.18.0 (indirect) from: go.etcd.io/etcd/server/v3
  - golang.org/x/sys@v0.18.0 (indirect) from: go.etcd.io/etcd/tests/v3
  - golang.org/x/sys@v0.18.0 (indirect) from: go.etcd.io/etcd/v3
FAIL: inconsistent dependencies

Update: fixed with subsequent commits

Signed-off-by: Chun-Hung Tseng <henrybear327@gmail.com>
…on v0.0.0-20180306012644-bacd9c7ef1dd

Signed-off-by: Chun-Hung Tseng <henrybear327@gmail.com>
Signed-off-by: Chun-Hung Tseng <henrybear327@gmail.com>
@ivanvc
Copy link
Member

ivanvc commented Jun 20, 2024

LGTM. Thanks, @henrybear327

@ahrtr ahrtr changed the title Fix dependency inconsistency detection and add make verify-dep [3.5] Fix dependency inconsistency detection and add make verify-dep Jun 20, 2024
Copy link
Member

@jmhbnz jmhbnz left a comment

Choose a reason for hiding this comment

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

LGTM - Thanks @henrybear327

@ahrtr ahrtr merged commit dcd7f29 into etcd-io:release-3.5 Jun 20, 2024
25 checks passed
@ivanvc ivanvc mentioned this pull request Jun 28, 2024
4 tasks
@ivanvc
Copy link
Member

ivanvc commented Jul 4, 2024

Link to #18180

aneesh1 pushed a commit to DataDog/etcd that referenced this pull request Sep 24, 2024
…stency

[3.5] Fix dependency inconsistency detection and add make verify-dep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

5 participants