From dd281fd616f2dd762826669dd52af37b1bb7fb83 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 8 Oct 2024 13:12:12 +0200 Subject: [PATCH] encoding/asn1: use slices.Equal in ObjectIdentifier.Equal Change-Id: I5efe3b9dcee85dfa34b6072c6f85108b6fc7cf99 Reviewed-on: https://go-review.googlesource.com/c/go/+/618515 Auto-Submit: Tobias Klauser LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor Reviewed-by: Roland Shoemaker --- src/encoding/asn1/asn1.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/encoding/asn1/asn1.go b/src/encoding/asn1/asn1.go index 56e007d3a6..488fb9b1e0 100644 --- a/src/encoding/asn1/asn1.go +++ b/src/encoding/asn1/asn1.go @@ -25,6 +25,7 @@ import ( "math" "math/big" "reflect" + "slices" "strconv" "strings" "time" @@ -224,16 +225,7 @@ type ObjectIdentifier []int // Equal reports whether oi and other represent the same identifier. func (oi ObjectIdentifier) Equal(other ObjectIdentifier) bool { - if len(oi) != len(other) { - return false - } - for i := 0; i < len(oi); i++ { - if oi[i] != other[i] { - return false - } - } - - return true + return slices.Equal(oi, other) } func (oi ObjectIdentifier) String() string { -- 2.48.1