aboutsummaryrefslogtreecommitdiff
path: root/src/crypto
diff options
context:
space:
mode:
authorAlan Donovan <adonovan@google.com>2025-11-11 14:48:22 -0500
committerGopher Robot <gobot@golang.org>2025-11-11 19:59:40 -0800
commit4bfc3a9d14c0b3bfcfe4ce987e47cda6720785a2 (patch)
tree0cbf1ec55d3a61af8bf45ac4a00af7e7bcc426db /src/crypto
parent2263d4aabdde8a4a466009ecc356501f87c7efb7 (diff)
downloadgo-4bfc3a9d14c0b3bfcfe4ce987e47cda6720785a2.tar.xz
std,cmd: go fix -any std cmd
This change mechanically replaces all occurrences of interface{} by 'any' (where deemed safe by the 'any' modernizer) throughout std and cmd, minus their vendor trees. Since this fix is relatively numerous, it gets its own CL. Also, 'go generate go/types'. Change-Id: I14a6b52856c3291c1d27935409bca8d5fd4242a2 Reviewed-on: https://go-review.googlesource.com/c/go/+/719702 Commit-Queue: Alan Donovan <adonovan@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/internal/cryptotest/methods.go4
-rw-r--r--src/crypto/internal/fips140/edwards25519/scalar_alias_test.go2
-rw-r--r--src/crypto/tls/fips140_test.go12
3 files changed, 9 insertions, 9 deletions
diff --git a/src/crypto/internal/cryptotest/methods.go b/src/crypto/internal/cryptotest/methods.go
index 9105eb30aa..f7d48a0fb8 100644
--- a/src/crypto/internal/cryptotest/methods.go
+++ b/src/crypto/internal/cryptotest/methods.go
@@ -19,7 +19,7 @@ import (
// of the API even if undocumented per Hyrum's Law.
//
// ms must be a pointer to a non-nil interface.
-func NoExtraMethods(t *testing.T, ms interface{}, allowed ...string) {
+func NoExtraMethods(t *testing.T, ms any, allowed ...string) {
t.Helper()
extraMethods, err := extraMethods(ms)
if err != nil {
@@ -33,7 +33,7 @@ func NoExtraMethods(t *testing.T, ms interface{}, allowed ...string) {
}
}
-func extraMethods(ip interface{}) ([]string, error) {
+func extraMethods(ip any) ([]string, error) {
v := reflect.ValueOf(ip)
if v.Kind() != reflect.Ptr || v.Elem().Kind() != reflect.Interface || v.Elem().IsNil() {
return nil, fmt.Errorf("argument must be a pointer to a non-nil interface")
diff --git a/src/crypto/internal/fips140/edwards25519/scalar_alias_test.go b/src/crypto/internal/fips140/edwards25519/scalar_alias_test.go
index 1893a7fc0c..47831dbfb2 100644
--- a/src/crypto/internal/fips140/edwards25519/scalar_alias_test.go
+++ b/src/crypto/internal/fips140/edwards25519/scalar_alias_test.go
@@ -71,7 +71,7 @@ func TestScalarAliasing(t *testing.T) {
return x == x1 && y == y1
}
- for name, f := range map[string]interface{}{
+ for name, f := range map[string]any{
"Negate": func(v, x Scalar) bool {
return checkAliasingOneArg((*Scalar).Negate, v, x)
},
diff --git a/src/crypto/tls/fips140_test.go b/src/crypto/tls/fips140_test.go
index d3fa61dc97..291a19f44c 100644
--- a/src/crypto/tls/fips140_test.go
+++ b/src/crypto/tls/fips140_test.go
@@ -404,7 +404,7 @@ func TestFIPSCertAlgs(t *testing.T) {
L2_I := fipsCert(t, "L2_I", fipsRSAKey(t, 1024), I_R1, fipsCertLeaf)
// client verifying server cert
- testServerCert := func(t *testing.T, desc string, pool *x509.CertPool, key interface{}, list [][]byte, ok bool) {
+ testServerCert := func(t *testing.T, desc string, pool *x509.CertPool, key any, list [][]byte, ok bool) {
clientConfig := testConfig.Clone()
clientConfig.RootCAs = pool
clientConfig.InsecureSkipVerify = false
@@ -432,7 +432,7 @@ func TestFIPSCertAlgs(t *testing.T) {
}
// server verifying client cert
- testClientCert := func(t *testing.T, desc string, pool *x509.CertPool, key interface{}, list [][]byte, ok bool) {
+ testClientCert := func(t *testing.T, desc string, pool *x509.CertPool, key any, list [][]byte, ok bool) {
clientConfig := testConfig.Clone()
clientConfig.ServerName = "example.com"
clientConfig.Certificates = []Certificate{{Certificate: list, PrivateKey: key}}
@@ -574,11 +574,11 @@ type fipsCertificate struct {
parentOrg string
der []byte
cert *x509.Certificate
- key interface{}
+ key any
fipsOK bool
}
-func fipsCert(t *testing.T, name string, key interface{}, parent *fipsCertificate, mode int) *fipsCertificate {
+func fipsCert(t *testing.T, name string, key any, parent *fipsCertificate, mode int) *fipsCertificate {
org := name
parentOrg := ""
if i := strings.Index(org, "_"); i >= 0 {
@@ -605,7 +605,7 @@ func fipsCert(t *testing.T, name string, key interface{}, parent *fipsCertificat
}
var pcert *x509.Certificate
- var pkey interface{}
+ var pkey any
if parent != nil {
pcert = parent.cert
pkey = parent.key
@@ -614,7 +614,7 @@ func fipsCert(t *testing.T, name string, key interface{}, parent *fipsCertificat
pkey = key
}
- var pub interface{}
+ var pub any
var desc string
switch k := key.(type) {
case *rsa.PrivateKey: