etcd-io / etcd

Distributed reliable key-value store for the most critical data of a distributed system
https://etcd.io
Apache License 2.0
46.77k stars 9.64k forks source link

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

Closed henrybear327 closed 1 week ago

henrybear327 commented 1 week ago

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 commented 1 week ago

/cc @ivanvc

henrybear327 commented 1 week ago

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

ivanvc commented 1 week ago

LGTM. Thanks, @henrybear327