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/database/sql/convert.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/database/sql/convert.go') diff --git a/src/database/sql/convert.go b/src/database/sql/convert.go index c0997b7fc5..4d9d070137 100644 --- a/src/database/sql/convert.go +++ b/src/database/sql/convert.go @@ -104,7 +104,7 @@ func defaultCheckNamedValue(nv *driver.NamedValue) (err error) { // The statement ds may be nil, if no statement is available. // // ci must be locked. -func driverArgsConnLocked(ci driver.Conn, ds *driverStmt, args []interface{}) ([]driver.NamedValue, error) { +func driverArgsConnLocked(ci driver.Conn, ds *driverStmt, args []any) ([]driver.NamedValue, error) { nvargs := make([]driver.NamedValue, len(args)) // -1 means the driver doesn't know how to count the number of @@ -207,7 +207,7 @@ func driverArgsConnLocked(ci driver.Conn, ds *driverStmt, args []interface{}) ([ // convertAssign is the same as convertAssignRows, but without the optional // rows argument. -func convertAssign(dest, src interface{}) error { +func convertAssign(dest, src any) error { return convertAssignRows(dest, src, nil) } @@ -216,7 +216,7 @@ func convertAssign(dest, src interface{}) error { // dest should be a pointer type. If rows is passed in, the rows will // be used as the parent for any cursor values converted from a // driver.Rows to a *Rows. -func convertAssignRows(dest, src interface{}, rows *Rows) error { +func convertAssignRows(dest, src any, rows *Rows) error { // Common cases, without reflect. switch s := src.(type) { case string: @@ -248,7 +248,7 @@ func convertAssignRows(dest, src interface{}, rows *Rows) error { } *d = string(s) return nil - case *interface{}: + case *any: if d == nil { return errNilPtr } @@ -295,7 +295,7 @@ func convertAssignRows(dest, src interface{}, rows *Rows) error { } case nil: switch d := dest.(type) { - case *interface{}: + case *any: if d == nil { return errNilPtr } @@ -376,7 +376,7 @@ func convertAssignRows(dest, src interface{}, rows *Rows) error { *d = bv.(bool) } return err - case *interface{}: + case *any: *d = src return nil } @@ -495,7 +495,7 @@ func cloneBytes(b []byte) []byte { return c } -func asString(src interface{}) string { +func asString(src any) string { switch v := src.(type) { case string: return v -- cgit v1.3-5-g9baa