From 2580d0e08d5e9f979b943758d3c49877fb2324cb Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 1 Dec 2021 12:15:45 -0500 Subject: all: gofmt -w -r 'interface{} -> any' src And then revert the bootstrap cmd directories and certain testdata. And adjust tests as needed. Not reverting the changes in std that are bootstrapped, because some of those changes would appear in API docs, and we want to use any consistently. Instead, rewrite 'any' to 'interface{}' in cmd/dist for those directories when preparing the bootstrap copy. A few files changed as a result of running gofmt -w not because of interface{} -> any but because they hadn't been updated for the new //go:build lines. Fixes #49884. Change-Id: Ie8045cba995f65bd79c694ec77a1b3d1fe01bb09 Reviewed-on: https://go-review.googlesource.com/c/go/+/368254 Trust: Russ Cox Run-TryBot: Russ Cox Reviewed-by: Robert Griesemer TryBot-Result: Gopher Robot --- src/cmd/api/goapi.go | 2 +- src/cmd/api/testdata/src/issue21181/p/p_generic.go | 1 + src/cmd/api/testdata/src/pkg/p1/p1.go | 2 +- src/cmd/api/testdata/src/pkg/p4/p4.go | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/cmd/api') diff --git a/src/cmd/api/goapi.go b/src/cmd/api/goapi.go index a55e51cc9b..036aefe4d8 100644 --- a/src/cmd/api/goapi.go +++ b/src/cmd/api/goapi.go @@ -1071,7 +1071,7 @@ func (w *Walker) emitMethod(m *types.Selection) { w.emitf("method (%s%s) %s%s", w.typeString(recv), tps, m.Obj().Name(), w.signatureString(sig)) } -func (w *Walker) emitf(format string, args ...interface{}) { +func (w *Walker) emitf(format string, args ...any) { f := strings.Join(w.scope, ", ") + ", " + fmt.Sprintf(format, args...) if strings.Contains(f, "\n") { panic("feature contains newlines: " + f) diff --git a/src/cmd/api/testdata/src/issue21181/p/p_generic.go b/src/cmd/api/testdata/src/issue21181/p/p_generic.go index 4d75809676..ad6df20187 100644 --- a/src/cmd/api/testdata/src/issue21181/p/p_generic.go +++ b/src/cmd/api/testdata/src/issue21181/p/p_generic.go @@ -1,3 +1,4 @@ +//go:build !amd64 // +build !amd64 package p diff --git a/src/cmd/api/testdata/src/pkg/p1/p1.go b/src/cmd/api/testdata/src/pkg/p1/p1.go index 65181b248a..81826d768b 100644 --- a/src/cmd/api/testdata/src/pkg/p1/p1.go +++ b/src/cmd/api/testdata/src/pkg/p1/p1.go @@ -197,7 +197,7 @@ var m map[string]int var chanVar chan int -var ifaceVar interface{} = 5 +var ifaceVar any = 5 var assertVar = ifaceVar.(int) diff --git a/src/cmd/api/testdata/src/pkg/p4/p4.go b/src/cmd/api/testdata/src/pkg/p4/p4.go index 462a75be1a..1f90e779dd 100644 --- a/src/cmd/api/testdata/src/pkg/p4/p4.go +++ b/src/cmd/api/testdata/src/pkg/p4/p4.go @@ -4,12 +4,12 @@ package p4 -type Pair[T1 interface { M() }, T2 ~int] struct { +type Pair[T1 interface{ M() }, T2 ~int] struct { f1 T1 f2 T2 } -func NewPair[T1 interface { M() }, T2 ~int](v1 T1, v2 T2) Pair[T1, T2] { +func NewPair[T1 interface{ M() }, T2 ~int](v1 T1, v2 T2) Pair[T1, T2] { return Pair[T1, T2]{f1: v1, f2: v2} } -- cgit v1.3-6-g1900