]> Cypherpunks repositories - gostls13.git/commitdiff
encoding/asn1: use slices.Equal in ObjectIdentifier.Equal
authorTobias Klauser <tklauser@distanz.ch>
Tue, 8 Oct 2024 11:12:12 +0000 (13:12 +0200)
committerGopher Robot <gobot@golang.org>
Tue, 8 Oct 2024 15:08:01 +0000 (15:08 +0000)
Change-Id: I5efe3b9dcee85dfa34b6072c6f85108b6fc7cf99
Reviewed-on: https://go-review.googlesource.com/c/go/+/618515
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
src/encoding/asn1/asn1.go

index 56e007d3a653436b2b0b0fb391c27e654e3b50cf..488fb9b1e096f10be13d8fae567247799b78f519 100644 (file)
@@ -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 {