diff options
| author | Alan Donovan <adonovan@google.com> | 2025-11-11 14:48:22 -0500 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-11-11 19:59:40 -0800 |
| commit | 4bfc3a9d14c0b3bfcfe4ce987e47cda6720785a2 (patch) | |
| tree | 0cbf1ec55d3a61af8bf45ac4a00af7e7bcc426db /src/internal | |
| parent | 2263d4aabdde8a4a466009ecc356501f87c7efb7 (diff) | |
| download | go-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/internal')
| -rw-r--r-- | src/internal/abi/funcpc.go | 4 | ||||
| -rw-r--r-- | src/internal/coverage/pods/pods.go | 2 | ||||
| -rw-r--r-- | src/internal/singleflight/singleflight_test.go | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/internal/abi/funcpc.go b/src/internal/abi/funcpc.go index e038d36584..54b0735f6b 100644 --- a/src/internal/abi/funcpc.go +++ b/src/internal/abi/funcpc.go @@ -19,7 +19,7 @@ package abi // compile-time error. // // Implemented as a compile intrinsic. -func FuncPCABI0(f interface{}) uintptr +func FuncPCABI0(f any) uintptr // FuncPCABIInternal returns the entry PC of the function f. If f is a // direct reference of a function, it must be defined as ABIInternal. @@ -28,4 +28,4 @@ func FuncPCABI0(f interface{}) uintptr // the behavior is undefined. // // Implemented as a compile intrinsic. -func FuncPCABIInternal(f interface{}) uintptr +func FuncPCABIInternal(f any) uintptr diff --git a/src/internal/coverage/pods/pods.go b/src/internal/coverage/pods/pods.go index e6180fb241..15b56f823a 100644 --- a/src/internal/coverage/pods/pods.go +++ b/src/internal/coverage/pods/pods.go @@ -192,7 +192,7 @@ func collectPodsImpl(files []string, dirIndices []int, warn bool) []Pod { return pods } -func warning(s string, a ...interface{}) { +func warning(s string, a ...any) { fmt.Fprintf(os.Stderr, "warning: ") fmt.Fprintf(os.Stderr, s, a...) fmt.Fprintf(os.Stderr, "\n") diff --git a/src/internal/singleflight/singleflight_test.go b/src/internal/singleflight/singleflight_test.go index 279e1beda1..0cce6a7422 100644 --- a/src/internal/singleflight/singleflight_test.go +++ b/src/internal/singleflight/singleflight_test.go @@ -97,7 +97,7 @@ func TestForgetUnshared(t *testing.T) { key := "key" firstCh := make(chan struct{}) go func() { - g.Do(key, func() (i interface{}, e error) { + g.Do(key, func() (i any, e error) { firstStarted.Done() <-firstCh return @@ -110,7 +110,7 @@ func TestForgetUnshared(t *testing.T) { secondCh := make(chan struct{}) go func() { - g.Do(key, func() (i interface{}, e error) { + g.Do(key, func() (i any, e error) { // Notify that we started secondCh <- struct{}{} <-secondCh @@ -120,7 +120,7 @@ func TestForgetUnshared(t *testing.T) { <-secondCh - resultCh := g.DoChan(key, func() (i interface{}, e error) { + resultCh := g.DoChan(key, func() (i any, e error) { panic("third must not be started") }) @@ -155,7 +155,7 @@ func TestDoAndForgetUnsharedRace(t *testing.T) { wg.Add(n) for i := 0; i < n; i++ { go func() { - g.Do(key, func() (interface{}, error) { + g.Do(key, func() (any, error) { time.Sleep(d) return calls.Add(1), nil }) |
