diff options
author | Daniel Martà <mvdan@mvdan.cc> | 2024-03-26 22:59:41 +0200 |
---|---|---|
committer | Daniel Martà <mvdan@mvdan.cc> | 2024-03-27 21:58:12 +0000 |
commit | 2e1003e2f7e42efc5771812b9ee6ed264803796c (patch) | |
tree | 1e70949071ddcf3eb2e63386e36d6083556a57c8 /src/cmd/go/internal/mvs/mvs.go | |
parent | 0c5612092deb0a50c5a3d67babc1249049595558 (diff) | |
download | go-2e1003e2f7e42efc5771812b9ee6ed264803796c.tar.gz go-2e1003e2f7e42efc5771812b9ee6ed264803796c.zip |
cmd/go: replace reflect.DeepEqual with slices.Equal and maps.Equal
All of these maps and slices are made up of comparable types,
so we can avoid the overhead of reflection entirely.
Change-Id: If77dbe648a336ba729c171e84c9ff3f7e160297d
Reviewed-on: https://go-review.googlesource.com/c/go/+/574597
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/cmd/go/internal/mvs/mvs.go')
-rw-r--r-- | src/cmd/go/internal/mvs/mvs.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/go/internal/mvs/mvs.go b/src/cmd/go/internal/mvs/mvs.go index 468a985927..1ac5aeb471 100644 --- a/src/cmd/go/internal/mvs/mvs.go +++ b/src/cmd/go/internal/mvs/mvs.go @@ -8,7 +8,7 @@ package mvs import ( "fmt" - "reflect" + "slices" "sort" "sync" @@ -171,7 +171,7 @@ func buildList(targets []module.Version, reqs Reqs, upgrade func(module.Version) // The final list is the minimum version of each module found in the graph. list := g.BuildList() - if vs := list[:len(targets)]; !reflect.DeepEqual(vs, targets) { + if vs := list[:len(targets)]; !slices.Equal(vs, targets) { // target.Version will be "" for modload, the main client of MVS. // "" denotes the main module, which has no version. However, MVS treats // version strings as opaque, so "" is not a special value here. |