]> Cypherpunks repositories - gostls13.git/commitdiff
std,cmd: go fix -any std cmd
authorAlan Donovan <adonovan@google.com>
Tue, 11 Nov 2025 19:48:22 +0000 (14:48 -0500)
committerGopher Robot <gobot@golang.org>
Wed, 12 Nov 2025 03:59:40 +0000 (19:59 -0800)
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>

99 files changed:
src/cmd/asm/internal/asm/endtoend_test.go
src/cmd/asm/internal/asm/parse.go
src/cmd/asm/internal/lex/input.go
src/cmd/asm/main.go
src/cmd/cgo/ast.go
src/cmd/cgo/gcc.go
src/cmd/cgo/godefs.go
src/cmd/cgo/internal/testplugin/plugin_test.go
src/cmd/cgo/main.go
src/cmd/cgo/out.go
src/cmd/cgo/util.go
src/cmd/compile/internal/abt/avlint32.go
src/cmd/compile/internal/abt/avlint32_test.go
src/cmd/compile/internal/base/print.go
src/cmd/compile/internal/base/timings.go
src/cmd/compile/internal/ir/dump.go
src/cmd/compile/internal/ir/func.go
src/cmd/compile/internal/ir/name.go
src/cmd/compile/internal/ir/sizeof_test.go
src/cmd/compile/internal/logopt/log_opts.go
src/cmd/compile/internal/loopvar/loopvar.go
src/cmd/compile/internal/noder/writer.go
src/cmd/compile/internal/ssa/block.go
src/cmd/compile/internal/ssa/cache.go
src/cmd/compile/internal/ssa/config.go
src/cmd/compile/internal/ssa/copyelim_test.go
src/cmd/compile/internal/ssa/debug.go
src/cmd/compile/internal/ssa/expand_calls.go
src/cmd/compile/internal/ssa/export_test.go
src/cmd/compile/internal/ssa/func.go
src/cmd/compile/internal/ssa/func_test.go
src/cmd/compile/internal/ssa/html.go
src/cmd/compile/internal/ssa/schedule.go
src/cmd/compile/internal/ssa/sizeof_test.go
src/cmd/compile/internal/ssa/value.go
src/cmd/compile/internal/ssagen/phi.go
src/cmd/compile/internal/ssagen/ssa.go
src/cmd/compile/internal/syntax/branches.go
src/cmd/compile/internal/syntax/dumper.go
src/cmd/compile/internal/syntax/printer.go
src/cmd/compile/internal/syntax/scanner.go
src/cmd/compile/internal/syntax/syntax.go
src/cmd/compile/internal/test/fixedbugs_test.go
src/cmd/compile/internal/test/iface_test.go
src/cmd/compile/internal/test/shift_test.go
src/cmd/compile/internal/typecheck/typecheck.go
src/cmd/compile/internal/types/fmt.go
src/cmd/compile/internal/types/sizeof_test.go
src/cmd/compile/internal/types/type.go
src/cmd/compile/internal/types2/check.go
src/cmd/compile/internal/types2/errors.go
src/cmd/compile/internal/types2/expr.go
src/cmd/compile/internal/types2/hilbert_test.go
src/cmd/compile/internal/types2/sizeof_test.go
src/cmd/compile/internal/types2/stdlib_test.go
src/cmd/compile/internal/types2/stmt.go
src/cmd/compile/internal/types2/unify.go
src/cmd/compile/internal/types2/version.go
src/cmd/covdata/covdata.go
src/cmd/dist/test.go
src/cmd/dist/util.go
src/cmd/go/internal/modload/import.go
src/cmd/internal/cov/readcovdata.go
src/cmd/internal/dwarf/dwarf.go
src/cmd/internal/macho/macho.go
src/cmd/internal/obj/dwarf.go
src/cmd/internal/obj/link.go
src/cmd/internal/obj/loong64/asm.go
src/cmd/internal/obj/pcln.go
src/cmd/internal/obj/ppc64/asm_test.go
src/cmd/internal/obj/sizeof_test.go
src/cmd/internal/objabi/flag.go
src/cmd/link/internal/ld/dwarf.go
src/cmd/link/internal/ld/link.go
src/cmd/link/internal/ld/macho_combine_dwarf.go
src/cmd/link/internal/ld/util.go
src/cmd/link/internal/ld/xcoff.go
src/cmd/link/internal/loadelf/ldelf.go
src/cmd/link/internal/loader/loader.go
src/cmd/link/internal/loadmacho/ldmacho.go
src/cmd/link/internal/loadxcoff/ldxcoff.go
src/cmd/link/internal/sym/segment.go
src/crypto/internal/cryptotest/methods.go
src/crypto/internal/fips140/edwards25519/scalar_alias_test.go
src/crypto/tls/fips140_test.go
src/encoding/gob/encoder_test.go
src/go/types/errors.go
src/go/types/expr.go
src/go/types/hilbert_test.go
src/go/types/unify.go
src/go/types/version.go
src/internal/abi/funcpc.go
src/internal/coverage/pods/pods.go
src/internal/singleflight/singleflight_test.go
src/math/big/alias_test.go
src/reflect/all_test.go
src/reflect/type_test.go
src/runtime/metrics_test.go
src/runtime/pprof/pprof_test.go

index 9571afc3260cb88a01073fcf2a597b6198d307af..e53263356d167b1757f0f5da6f8b82f0675f70f4 100644 (file)
@@ -38,7 +38,7 @@ func testEndToEnd(t *testing.T, goarch, file string) {
        ctxt.IsAsm = true
        defer ctxt.Bso.Flush()
        failed := false
-       ctxt.DiagFunc = func(format string, args ...interface{}) {
+       ctxt.DiagFunc = func(format string, args ...any) {
                failed = true
                t.Errorf(format, args...)
        }
@@ -193,7 +193,7 @@ Diff:
        top := pList.Firstpc
        var text *obj.LSym
        ok = true
-       ctxt.DiagFunc = func(format string, args ...interface{}) {
+       ctxt.DiagFunc = func(format string, args ...any) {
                t.Errorf(format, args...)
                ok = false
        }
@@ -294,7 +294,7 @@ func testErrors(t *testing.T, goarch, file string, flags ...string) {
        failed := false
        var errBuf bytes.Buffer
        parser.errorWriter = &errBuf
-       ctxt.DiagFunc = func(format string, args ...interface{}) {
+       ctxt.DiagFunc = func(format string, args ...any) {
                failed = true
                s := fmt.Sprintf(format, args...)
                if !strings.HasSuffix(s, "\n") {
index 545f6c7553351b2f4cdbce861eee97a4bd2ae9cd..25d596f4d6656b10fe09479e4f5c8723a83feca3 100644 (file)
@@ -78,7 +78,7 @@ func NewParser(ctxt *obj.Link, ar *arch.Arch, lexer lex.TokenReader) *Parser {
 // and turn it into a recoverable panic.
 var panicOnError bool
 
-func (p *Parser) errorf(format string, args ...interface{}) {
+func (p *Parser) errorf(format string, args ...any) {
        if panicOnError {
                panic(fmt.Errorf(format, args...))
        }
@@ -90,7 +90,7 @@ func (p *Parser) errorf(format string, args ...interface{}) {
        if p.lex != nil {
                // Put file and line information on head of message.
                format = "%s:%d: " + format + "\n"
-               args = append([]interface{}{p.lex.File(), p.lineNum}, args...)
+               args = append([]any{p.lex.File(), p.lineNum}, args...)
        }
        fmt.Fprintf(p.errorWriter, format, args...)
        p.errorCount++
index 789e229a77991691d4e03e32ab670480ce909a4d..342ac5ac483beb6ebee233d3770b5d4cf9413d4a 100644 (file)
@@ -68,7 +68,7 @@ func predefine(defines flags.MultiFlag) map[string]*Macro {
 
 var panicOnError bool // For testing.
 
-func (in *Input) Error(args ...interface{}) {
+func (in *Input) Error(args ...any) {
        if panicOnError {
                panic(fmt.Errorf("%s:%d: %s", in.File(), in.Line(), fmt.Sprintln(args...)))
        }
@@ -77,7 +77,7 @@ func (in *Input) Error(args ...interface{}) {
 }
 
 // expectText is like Error but adds "got XXX" where XXX is a quoted representation of the most recent token.
-func (in *Input) expectText(args ...interface{}) {
+func (in *Input) expectText(args ...any) {
        in.Error(append(args, "; got", strconv.Quote(in.Stack.Text()))...)
 }
 
index 9db1fec8beac3c552a0decaba4277a6f2af9b21c..f2697db5169d7d39ea1a08c6b48ad5548764b9a8 100644 (file)
@@ -93,7 +93,7 @@ func main() {
        for _, f := range flag.Args() {
                lexer := lex.NewLexer(f)
                parser := asm.NewParser(ctxt, architecture, lexer)
-               ctxt.DiagFunc = func(format string, args ...interface{}) {
+               ctxt.DiagFunc = func(format string, args ...any) {
                        diag = true
                        log.Printf(format, args...)
                }
index 97b18cd22d4d4c08c5acd99da54fcc58ce30336c..2da6ca5a30f38ad36c59df6fd7f995fd3fce0c75 100644 (file)
@@ -199,7 +199,7 @@ func commentText(g *ast.CommentGroup) string {
        return strings.Join(pieces, "")
 }
 
-func (f *File) validateIdents(x interface{}, context astContext) {
+func (f *File) validateIdents(x any, context astContext) {
        if x, ok := x.(*ast.Ident); ok {
                if f.isMangledName(x.Name) {
                        error_(x.Pos(), "identifier %q may conflict with identifiers generated by cgo", x.Name)
@@ -208,7 +208,7 @@ func (f *File) validateIdents(x interface{}, context astContext) {
 }
 
 // Save various references we are going to need later.
-func (f *File) saveExprs(x interface{}, context astContext) {
+func (f *File) saveExprs(x any, context astContext) {
        switch x := x.(type) {
        case *ast.Expr:
                switch (*x).(type) {
@@ -278,7 +278,7 @@ func (f *File) saveCall(call *ast.CallExpr, context astContext) {
 }
 
 // If a function should be exported add it to ExpFunc.
-func (f *File) saveExport(x interface{}, context astContext) {
+func (f *File) saveExport(x any, context astContext) {
        n, ok := x.(*ast.FuncDecl)
        if !ok {
                return
@@ -318,7 +318,7 @@ func (f *File) saveExport(x interface{}, context astContext) {
 }
 
 // Make f.ExpFunc[i] point at the Func from this AST instead of the other one.
-func (f *File) saveExport2(x interface{}, context astContext) {
+func (f *File) saveExport2(x any, context astContext) {
        n, ok := x.(*ast.FuncDecl)
        if !ok {
                return
@@ -355,7 +355,7 @@ const (
 )
 
 // walk walks the AST x, calling visit(f, x, context) for each node.
-func (f *File) walk(x interface{}, context astContext, visit func(*File, interface{}, astContext)) {
+func (f *File) walk(x any, context astContext, visit func(*File, any, astContext)) {
        visit(f, x, context)
        switch n := x.(type) {
        case *ast.Expr:
index d1b629057ab4a82ee18a77783e07de3d638ccdce..d3de3906b48eb0cd8ee130d1be6369718083dd9a 100644 (file)
@@ -1158,7 +1158,7 @@ func (p *Package) hasPointer(f *File, t ast.Expr, top bool) bool {
 // If addPosition is true, add position info to the idents of C names in arg.
 func (p *Package) mangle(f *File, arg *ast.Expr, addPosition bool) (ast.Expr, bool) {
        needsUnsafe := false
-       f.walk(arg, ctxExpr, func(f *File, arg interface{}, context astContext) {
+       f.walk(arg, ctxExpr, func(f *File, arg any, context astContext) {
                px, ok := arg.(*ast.Expr)
                if !ok {
                        return
@@ -2439,7 +2439,7 @@ func (tr *TypeRepr) Empty() bool {
 // Set modifies the type representation.
 // If fargs are provided, repr is used as a format for fmt.Sprintf.
 // Otherwise, repr is used unprocessed as the type representation.
-func (tr *TypeRepr) Set(repr string, fargs ...interface{}) {
+func (tr *TypeRepr) Set(repr string, fargs ...any) {
        tr.Repr = repr
        tr.FormatArgs = fargs
 }
@@ -2713,7 +2713,7 @@ func (c *typeConv) loadType(dtype dwarf.Type, pos token.Pos, parent string) *Typ
                        // so execute the basic things that the struct case would do
                        // other than try to determine a Go representation.
                        tt := *t
-                       tt.C = &TypeRepr{"%s %s", []interface{}{dt.Kind, tag}}
+                       tt.C = &TypeRepr{"%s %s", []any{dt.Kind, tag}}
                        // We don't know what the representation of this struct is, so don't let
                        // anyone allocate one on the Go side. As a side effect of this annotation,
                        // pointers to this type will not be considered pointers in Go. They won't
@@ -2743,7 +2743,7 @@ func (c *typeConv) loadType(dtype dwarf.Type, pos token.Pos, parent string) *Typ
                        t.Align = align
                        tt := *t
                        if tag != "" {
-                               tt.C = &TypeRepr{"struct %s", []interface{}{tag}}
+                               tt.C = &TypeRepr{"struct %s", []any{tag}}
                        }
                        tt.Go = g
                        if c.incompleteStructs[tag] {
index 9cf626c17322c29e5c3c432842496901c9312c14..93f9027157183b1f03df7012a75d88cd02d59236 100644 (file)
@@ -117,7 +117,7 @@ func (p *Package) godefs(f *File, args []string) string {
 var gofmtBuf strings.Builder
 
 // gofmt returns the gofmt-formatted string for an AST node.
-func gofmt(n interface{}) string {
+func gofmt(n any) string {
        gofmtBuf.Reset()
        err := printer.Fprint(&gofmtBuf, fset, n)
        if err != nil {
index 2afb542ec4f17c43ace6529613ce737bbd758b7a..3216073edbcb2d34970c91ede071313aa361ab82 100644 (file)
@@ -37,7 +37,7 @@ func TestMain(m *testing.M) {
 var tmpDir string
 
 // prettyPrintf prints lines with tmpDir sanitized.
-func prettyPrintf(format string, args ...interface{}) {
+func prettyPrintf(format string, args ...any) {
        s := fmt.Sprintf(format, args...)
        if tmpDir != "" {
                s = strings.ReplaceAll(s, tmpDir, "$TMPDIR")
index 955d64b9569406328e0c4ad676f1774b29269fc3..ba8e52a6e0232e03cbebe93645d49a5f42ecb5f8 100644 (file)
@@ -148,7 +148,7 @@ type ExpFunc struct {
 // A TypeRepr contains the string representation of a type.
 type TypeRepr struct {
        Repr       string
-       FormatArgs []interface{}
+       FormatArgs []any
 }
 
 // A Type collects information about a type in both the C and Go worlds.
index f0e07284ec30078a1efd2873f8cbdf84f3985dc8..701a8530ffc9840e7f9fca0ed57d577771c895d2 100644 (file)
@@ -953,7 +953,7 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
                npad := 0
                // the align is at least 1 (for char)
                maxAlign := int64(1)
-               argField := func(typ ast.Expr, namePat string, args ...interface{}) {
+               argField := func(typ ast.Expr, namePat string, args ...any) {
                        name := fmt.Sprintf(namePat, args...)
                        t := p.cgoType(typ)
                        if off%t.Align != 0 {
@@ -1412,7 +1412,7 @@ func forFieldList(fl *ast.FieldList, fn func(int, string, ast.Expr)) {
        }
 }
 
-func c(repr string, args ...interface{}) *TypeRepr {
+func c(repr string, args ...any) *TypeRepr {
        return &TypeRepr{repr, args}
 }
 
index 23b4a414db75621bc281fff147ee6f861e4555c9..e83634ffb222a0cb2178a9f5776cd347694191fc 100644 (file)
@@ -75,7 +75,7 @@ func lineno(pos token.Pos) string {
 }
 
 // Die with an error message.
-func fatalf(msg string, args ...interface{}) {
+func fatalf(msg string, args ...any) {
        // If we've already printed other errors, they might have
        // caused the fatal condition. Assume they're enough.
        if nerrors == 0 {
@@ -86,7 +86,7 @@ func fatalf(msg string, args ...interface{}) {
 
 var nerrors int
 
-func error_(pos token.Pos, msg string, args ...interface{}) {
+func error_(pos token.Pos, msg string, args ...any) {
        nerrors++
        if pos.IsValid() {
                fmt.Fprintf(os.Stderr, "%s: ", fset.Position(pos).String())
index ddfca346a2f7516f04b2a1c969510c4a87755dbf..e41a6c0ca40bd87477bc2a2c01065f98b6e836a1 100644 (file)
@@ -28,7 +28,7 @@ type T struct {
 type node32 struct {
        // Standard conventions hold for left = smaller, right = larger
        left, right *node32
-       data        interface{}
+       data        any
        key         int32
        height_     int8
 }
@@ -49,21 +49,21 @@ func (t *T) IsSingle() bool {
 
 // VisitInOrder applies f to the key and data pairs in t,
 // with keys ordered from smallest to largest.
-func (t *T) VisitInOrder(f func(int32, interface{})) {
+func (t *T) VisitInOrder(f func(int32, any)) {
        if t.root == nil {
                return
        }
        t.root.visitInOrder(f)
 }
 
-func (n *node32) nilOrData() interface{} {
+func (n *node32) nilOrData() any {
        if n == nil {
                return nil
        }
        return n.data
 }
 
-func (n *node32) nilOrKeyAndData() (k int32, d interface{}) {
+func (n *node32) nilOrKeyAndData() (k int32, d any) {
        if n == nil {
                k = NOT_KEY32
                d = nil
@@ -83,7 +83,7 @@ func (n *node32) height() int8 {
 
 // Find returns the data associated with x in the tree, or
 // nil if x is not in the tree.
-func (t *T) Find(x int32) interface{} {
+func (t *T) Find(x int32) any {
        return t.root.find(x).nilOrData()
 }
 
@@ -92,7 +92,7 @@ func (t *T) Find(x int32) interface{} {
 // x was already a key in the tree.  The previous data associated
 // with x is returned, and is nil if x was not previously a
 // key in the tree.
-func (t *T) Insert(x int32, data interface{}) interface{} {
+func (t *T) Insert(x int32, data any) any {
        if x == NOT_KEY32 {
                panic("Cannot use sentinel value -0x80000000 as key")
        }
@@ -105,7 +105,7 @@ func (t *T) Insert(x int32, data interface{}) interface{} {
        } else {
                newroot, n, o = n.aInsert(x)
        }
-       var r interface{}
+       var r any
        if o != nil {
                r = o.data
        } else {
@@ -121,7 +121,7 @@ func (t *T) Copy() *T {
        return &u
 }
 
-func (t *T) Delete(x int32) interface{} {
+func (t *T) Delete(x int32) any {
        n := t.root
        if n == nil {
                return nil
@@ -135,7 +135,7 @@ func (t *T) Delete(x int32) interface{} {
        return d.data
 }
 
-func (t *T) DeleteMin() (int32, interface{}) {
+func (t *T) DeleteMin() (int32, any) {
        n := t.root
        if n == nil {
                return NOT_KEY32, nil
@@ -149,7 +149,7 @@ func (t *T) DeleteMin() (int32, interface{}) {
        return d.key, d.data
 }
 
-func (t *T) DeleteMax() (int32, interface{}) {
+func (t *T) DeleteMax() (int32, any) {
        n := t.root
        if n == nil {
                return NOT_KEY32, nil
@@ -172,7 +172,7 @@ func (t *T) Size() int {
 // not be symmetric.  If f returns nil, then the key and data are not
 // added to the result.  If f itself is nil, then whatever value was
 // already present in the smaller set is used.
-func (t *T) Intersection(u *T, f func(x, y interface{}) interface{}) *T {
+func (t *T) Intersection(u *T, f func(x, y any) any) *T {
        if t.Size() == 0 || u.Size() == 0 {
                return &T{}
        }
@@ -227,7 +227,7 @@ func (t *T) Intersection(u *T, f func(x, y interface{}) interface{}) *T {
 // is given by f(t's data, u's data) -- f need not be symmetric.  If f returns nil,
 // then the key and data are not added to the result.  If f itself is nil, then
 // whatever value was already present in the larger set is used.
-func (t *T) Union(u *T, f func(x, y interface{}) interface{}) *T {
+func (t *T) Union(u *T, f func(x, y any) any) *T {
        if t.Size() == 0 {
                return u
        }
@@ -284,7 +284,7 @@ func (t *T) Union(u *T, f func(x, y interface{}) interface{}) *T {
 // of f applied to data corresponding to equal keys.  If f returns nil
 // (or if f is nil) then the key+data are excluded, as usual.  If f
 // returns not-nil, then that key+data pair is inserted. instead.
-func (t *T) Difference(u *T, f func(x, y interface{}) interface{}) *T {
+func (t *T) Difference(u *T, f func(x, y any) any) *T {
        if t.Size() == 0 {
                return &T{}
        }
@@ -365,7 +365,7 @@ func (t *node32) equals(u *node32) bool {
        return it.done() == iu.done()
 }
 
-func (t *T) Equiv(u *T, eqv func(x, y interface{}) bool) bool {
+func (t *T) Equiv(u *T, eqv func(x, y any) bool) bool {
        if t == u {
                return true
        }
@@ -375,7 +375,7 @@ func (t *T) Equiv(u *T, eqv func(x, y interface{}) bool) bool {
        return t.root.equiv(u.root, eqv)
 }
 
-func (t *node32) equiv(u *node32, eqv func(x, y interface{}) bool) bool {
+func (t *node32) equiv(u *node32, eqv func(x, y any) bool) bool {
        if t == u {
                return true
        }
@@ -404,7 +404,7 @@ type Iterator struct {
        it iterator
 }
 
-func (it *Iterator) Next() (int32, interface{}) {
+func (it *Iterator) Next() (int32, any) {
        x := it.it.next()
        if x == nil {
                return NOT_KEY32, nil
@@ -461,37 +461,37 @@ func (it *iterator) next() *node32 {
 
 // Min returns the minimum element of t.
 // If t is empty, then (NOT_KEY32, nil) is returned.
-func (t *T) Min() (k int32, d interface{}) {
+func (t *T) Min() (k int32, d any) {
        return t.root.min().nilOrKeyAndData()
 }
 
 // Max returns the maximum element of t.
 // If t is empty, then (NOT_KEY32, nil) is returned.
-func (t *T) Max() (k int32, d interface{}) {
+func (t *T) Max() (k int32, d any) {
        return t.root.max().nilOrKeyAndData()
 }
 
 // Glb returns the greatest-lower-bound-exclusive of x and the associated
 // data.  If x has no glb in the tree, then (NOT_KEY32, nil) is returned.
-func (t *T) Glb(x int32) (k int32, d interface{}) {
+func (t *T) Glb(x int32) (k int32, d any) {
        return t.root.glb(x, false).nilOrKeyAndData()
 }
 
 // GlbEq returns the greatest-lower-bound-inclusive of x and the associated
 // data.  If x has no glbEQ in the tree, then (NOT_KEY32, nil) is returned.
-func (t *T) GlbEq(x int32) (k int32, d interface{}) {
+func (t *T) GlbEq(x int32) (k int32, d any) {
        return t.root.glb(x, true).nilOrKeyAndData()
 }
 
 // Lub returns the least-upper-bound-exclusive of x and the associated
 // data.  If x has no lub in the tree, then (NOT_KEY32, nil) is returned.
-func (t *T) Lub(x int32) (k int32, d interface{}) {
+func (t *T) Lub(x int32) (k int32, d any) {
        return t.root.lub(x, false).nilOrKeyAndData()
 }
 
 // LubEq returns the least-upper-bound-inclusive of x and the associated
 // data.  If x has no lubEq in the tree, then (NOT_KEY32, nil) is returned.
-func (t *T) LubEq(x int32) (k int32, d interface{}) {
+func (t *T) LubEq(x int32) (k int32, d any) {
        return t.root.lub(x, true).nilOrKeyAndData()
 }
 
@@ -499,7 +499,7 @@ func (t *node32) isLeaf() bool {
        return t.left == nil && t.right == nil && t.height_ == LEAF_HEIGHT
 }
 
-func (t *node32) visitInOrder(f func(int32, interface{})) {
+func (t *node32) visitInOrder(f func(int32, any)) {
        if t.left != nil {
                t.left.visitInOrder(f)
        }
index 7fa9ed4fd68236d7dcb2198fc95c97f91fcd7626..71962445f2b1d810564046290b7dada0b9899258 100644 (file)
@@ -317,7 +317,7 @@ func applicIterator(te *testing.T, x []int32) {
        }
 }
 
-func equiv(a, b interface{}) bool {
+func equiv(a, b any) bool {
        sa, sb := a.(*sstring), b.(*sstring)
        return *sa == *sb
 }
@@ -450,16 +450,16 @@ func TestEquals(t *testing.T) {
                []int32{1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2})
 }
 
-func first(x, y interface{}) interface{} {
+func first(x, y any) any {
        return x
 }
-func second(x, y interface{}) interface{} {
+func second(x, y any) any {
        return y
 }
-func alwaysNil(x, y interface{}) interface{} {
+func alwaysNil(x, y any) any {
        return nil
 }
-func smaller(x, y interface{}) interface{} {
+func smaller(x, y any) any {
        xi, _ := strconv.Atoi(fmt.Sprint(x))
        yi, _ := strconv.Atoi(fmt.Sprint(y))
        if xi < yi {
@@ -560,7 +560,7 @@ func (s *sstring) String() string {
        return s.s
 }
 
-func stringer(s string) interface{} {
+func stringer(s string) any {
        return &sstring{s}
 }
 
index 9e3348c1ecca899f37998529d9769242d78936ac..6bfc84cd62df648072689012a8a3fbd9d1683973 100644 (file)
@@ -45,7 +45,7 @@ func SyntaxErrors() int {
 }
 
 // addErrorMsg adds a new errorMsg (which may be a warning) to errorMsgs.
-func addErrorMsg(pos src.XPos, code errors.Code, format string, args ...interface{}) {
+func addErrorMsg(pos src.XPos, code errors.Code, format string, args ...any) {
        msg := fmt.Sprintf(format, args...)
        // Only add the position if know the position.
        // See issue golang.org/issue/11361.
@@ -108,12 +108,12 @@ func sameline(a, b src.XPos) bool {
 }
 
 // Errorf reports a formatted error at the current line.
-func Errorf(format string, args ...interface{}) {
+func Errorf(format string, args ...any) {
        ErrorfAt(Pos, 0, format, args...)
 }
 
 // ErrorfAt reports a formatted error message at pos.
-func ErrorfAt(pos src.XPos, code errors.Code, format string, args ...interface{}) {
+func ErrorfAt(pos src.XPos, code errors.Code, format string, args ...any) {
        msg := fmt.Sprintf(format, args...)
 
        if strings.HasPrefix(msg, "syntax error") {
@@ -164,7 +164,7 @@ func UpdateErrorDot(line string, name, expr string) {
 // In general the Go compiler does NOT generate warnings,
 // so this should be used only when the user has opted in
 // to additional output by setting a particular flag.
-func Warn(format string, args ...interface{}) {
+func Warn(format string, args ...any) {
        WarnfAt(Pos, format, args...)
 }
 
@@ -172,7 +172,7 @@ func Warn(format string, args ...interface{}) {
 // In general the Go compiler does NOT generate warnings,
 // so this should be used only when the user has opted in
 // to additional output by setting a particular flag.
-func WarnfAt(pos src.XPos, format string, args ...interface{}) {
+func WarnfAt(pos src.XPos, format string, args ...any) {
        addErrorMsg(pos, 0, format, args...)
        if Flag.LowerM != 0 {
                FlushErrors()
@@ -191,7 +191,7 @@ func WarnfAt(pos src.XPos, format string, args ...interface{}) {
 // prints a stack trace.
 //
 // If -h has been specified, Fatalf panics to force the usual runtime info dump.
-func Fatalf(format string, args ...interface{}) {
+func Fatalf(format string, args ...any) {
        FatalfAt(Pos, format, args...)
 }
 
@@ -209,7 +209,7 @@ var bugStack = counter.NewStack("compile/bug", 16) // 16 is arbitrary; used by g
 // prints a stack trace.
 //
 // If -h has been specified, FatalfAt panics to force the usual runtime info dump.
-func FatalfAt(pos src.XPos, format string, args ...interface{}) {
+func FatalfAt(pos src.XPos, format string, args ...any) {
        FlushErrors()
 
        bugStack.Inc()
@@ -244,14 +244,14 @@ func Assert(b bool) {
 }
 
 // Assertf reports a fatal error with Fatalf, unless b is true.
-func Assertf(b bool, format string, args ...interface{}) {
+func Assertf(b bool, format string, args ...any) {
        if !b {
                Fatalf(format, args...)
        }
 }
 
 // AssertfAt reports a fatal error with FatalfAt, unless b is true.
-func AssertfAt(b bool, pos src.XPos, format string, args ...interface{}) {
+func AssertfAt(b bool, pos src.XPos, format string, args ...any) {
        if !b {
                FatalfAt(pos, format, args...)
        }
index f48ac93699b816a3f43de3e527a45350f74bb2ba..cbcd4dc6f55b55279597ccdd6ebeaacb14dfec46 100644 (file)
@@ -168,7 +168,7 @@ type lines [][]string
 
 func (lines *lines) add(label string, n int, dt, tot time.Duration, events []*event) {
        var line []string
-       add := func(format string, args ...interface{}) {
+       add := func(format string, args ...any) {
                line = append(line, fmt.Sprintf(format, args...))
        }
 
index 4c218682ea6c758d8d8c757826478a067b77fc64..3e5e6fbdcee95fb9bf9f5ed01659a59e85ca0519 100644 (file)
@@ -21,7 +21,7 @@ import (
 )
 
 // DumpAny is like FDumpAny but prints to stderr.
-func DumpAny(root interface{}, filter string, depth int) {
+func DumpAny(root any, filter string, depth int) {
        FDumpAny(os.Stderr, root, filter, depth)
 }
 
@@ -42,7 +42,7 @@ func DumpAny(root interface{}, filter string, depth int) {
 // rather than their type; struct fields with zero values or
 // non-matching field names are omitted, and "…" means recursion
 // depth has been reached or struct fields have been omitted.
-func FDumpAny(w io.Writer, root interface{}, filter string, depth int) {
+func FDumpAny(w io.Writer, root any, filter string, depth int) {
        if root == nil {
                fmt.Fprintln(w, "nil")
                return
@@ -110,7 +110,7 @@ func (p *dumper) Write(data []byte) (n int, err error) {
 }
 
 // printf is a convenience wrapper.
-func (p *dumper) printf(format string, args ...interface{}) {
+func (p *dumper) printf(format string, args ...any) {
        if _, err := fmt.Fprintf(p, format, args...); err != nil {
                panic(err)
        }
index 668537c90e6a4090007ce1b0588152d34ef445e7..e027fe829088c2219af260de95b64d9db1f07fcc 100644 (file)
@@ -90,7 +90,7 @@ type Func struct {
        Marks []Mark
 
        FieldTrack map[*obj.LSym]struct{}
-       DebugInfo  interface{}
+       DebugInfo  any
        LSym       *obj.LSym // Linker object in this function's native ABI (Func.ABI)
 
        Inl *Inline
index 6f8d0a7fcc1989a9f11fbe49b3b2bfd4ff73f4b2..01f1c0c5022e05fa2d19edbb475dd4939a707097 100644 (file)
@@ -43,8 +43,8 @@ type Name struct {
        Func      *Func // TODO(austin): nil for I.M
        Offset_   int64
        val       constant.Value
-       Opt       interface{} // for use by escape analysis
-       Embed     *[]Embed    // list of embedded files, for ONAME var
+       Opt       any      // for use by escape analysis
+       Embed     *[]Embed // list of embedded files, for ONAME var
 
        // For a local variable (not param) or extern, the initializing assignment (OAS or OAS2).
        // For a closure var, the ONAME node of the original (outermost) captured variable.
index 14b6b4f3cd475053f03730011286bf559953846d..b805155e6e3b799290b8752316e528f647f56d9b 100644 (file)
@@ -16,9 +16,9 @@ func TestSizeof(t *testing.T) {
        const _64bit = unsafe.Sizeof(uintptr(0)) == 8
 
        var tests = []struct {
-               val    interface{} // type as a value
-               _32bit uintptr     // size on 32bit platforms
-               _64bit uintptr     // size on 64bit platforms
+               val    any     // type as a value
+               _32bit uintptr // size on 32bit platforms
+               _64bit uintptr // size on 64bit platforms
        }{
                {Func{}, 184, 312},
                {Name{}, 96, 160},
index d08f6fb5d6d92f7e3664cf80b339491135d5b936..c47c9ee5afb23bf8a1fd6030bacb8326868e978f 100644 (file)
@@ -224,12 +224,12 @@ type Diagnostic struct {
 // A LoggedOpt is what the compiler produces and accumulates,
 // to be converted to JSON for human or IDE consumption.
 type LoggedOpt struct {
-       pos          src.XPos      // Source code position at which the event occurred. If it is inlined, outer and all inlined locations will appear in JSON.
-       lastPos      src.XPos      // Usually the same as pos; current exception is for reporting entire range of transformed loops
-       compilerPass string        // Compiler pass.  For human/adhoc consumption; does not appear in JSON (yet)
-       functionName string        // Function name.  For human/adhoc consumption; does not appear in JSON (yet)
-       what         string        // The (non) optimization; "nilcheck", "boundsCheck", "inline", "noInline"
-       target       []interface{} // Optional target(s) or parameter(s) of "what" -- what was inlined, why it was not, size of copy, etc. 1st is most important/relevant.
+       pos          src.XPos // Source code position at which the event occurred. If it is inlined, outer and all inlined locations will appear in JSON.
+       lastPos      src.XPos // Usually the same as pos; current exception is for reporting entire range of transformed loops
+       compilerPass string   // Compiler pass.  For human/adhoc consumption; does not appear in JSON (yet)
+       functionName string   // Function name.  For human/adhoc consumption; does not appear in JSON (yet)
+       what         string   // The (non) optimization; "nilcheck", "boundsCheck", "inline", "noInline"
+       target       []any    // Optional target(s) or parameter(s) of "what" -- what was inlined, why it was not, size of copy, etc. 1st is most important/relevant.
 }
 
 type logFormat uint8
@@ -325,7 +325,7 @@ var mu = sync.Mutex{} // mu protects loggedOpts.
 // Pos is the source position (including inlining), what is the message, pass is which pass created the message,
 // funcName is the name of the function
 // A typical use for this to accumulate an explanation for a missed optimization, for example, why did something escape?
-func NewLoggedOpt(pos, lastPos src.XPos, what, pass, funcName string, args ...interface{}) *LoggedOpt {
+func NewLoggedOpt(pos, lastPos src.XPos, what, pass, funcName string, args ...any) *LoggedOpt {
        pass = strings.ReplaceAll(pass, " ", "_")
        return &LoggedOpt{pos, lastPos, pass, funcName, what, args}
 }
@@ -333,7 +333,7 @@ func NewLoggedOpt(pos, lastPos src.XPos, what, pass, funcName string, args ...in
 // LogOpt logs information about a (usually missed) optimization performed by the compiler.
 // Pos is the source position (including inlining), what is the message, pass is which pass created the message,
 // funcName is the name of the function.
-func LogOpt(pos src.XPos, what, pass, funcName string, args ...interface{}) {
+func LogOpt(pos src.XPos, what, pass, funcName string, args ...any) {
        if Format == None {
                return
        }
@@ -346,7 +346,7 @@ func LogOpt(pos src.XPos, what, pass, funcName string, args ...interface{}) {
 
 // LogOptRange is the same as LogOpt, but includes the ability to express a range of positions,
 // not just a point.
-func LogOptRange(pos, lastPos src.XPos, what, pass, funcName string, args ...interface{}) {
+func LogOptRange(pos, lastPos src.XPos, what, pass, funcName string, args ...any) {
        if Format == None {
                return
        }
index 5a4590d2998d0c9380d5dc044f077b736c340887..267df2f905c086a9f13b3af13c89e4c65ac52c50 100644 (file)
@@ -557,7 +557,7 @@ func LogTransformations(transformed []VarAndLoop) {
 
                        if logopt.Enabled() {
                                // For automated checking of coverage of this transformation, include this in the JSON information.
-                               var nString interface{} = n
+                               var nString any = n
                                if inner != outer {
                                        nString = fmt.Sprintf("%v (from inline)", n)
                                }
index 9c90d221c28a7e8e3e3f7ffa9573ad6e384f135c..0b5aa007bf940485b418e580e45c34782092f9d5 100644 (file)
@@ -120,12 +120,12 @@ func newPkgWriter(m posMap, pkg *types2.Package, info *types2.Info, otherInfo ma
 }
 
 // errorf reports a user error about thing p.
-func (pw *pkgWriter) errorf(p poser, msg string, args ...interface{}) {
+func (pw *pkgWriter) errorf(p poser, msg string, args ...any) {
        base.ErrorfAt(pw.m.pos(p), 0, msg, args...)
 }
 
 // fatalf reports an internal compiler error about thing p.
-func (pw *pkgWriter) fatalf(p poser, msg string, args ...interface{}) {
+func (pw *pkgWriter) fatalf(p poser, msg string, args ...any) {
        base.FatalfAt(pw.m.pos(p), msg, args...)
 }
 
index 1240bfd6556a1108a2717cb72726097bebdcab01..278a6b0d1d081d519503d5cc1f6dbf4cce46064a 100644 (file)
@@ -424,9 +424,9 @@ func (b *Block) likelyBranch() bool {
        return true
 }
 
-func (b *Block) Logf(msg string, args ...interface{})   { b.Func.Logf(msg, args...) }
-func (b *Block) Log() bool                              { return b.Func.Log() }
-func (b *Block) Fatalf(msg string, args ...interface{}) { b.Func.Fatalf(msg, args...) }
+func (b *Block) Logf(msg string, args ...any)   { b.Func.Logf(msg, args...) }
+func (b *Block) Log() bool                      { return b.Func.Log() }
+func (b *Block) Fatalf(msg string, args ...any) { b.Func.Fatalf(msg, args...) }
 
 type BranchPrediction int8
 
index 0c16efcd57d6acbb990d99ba08b81f448db5a985..59d768c34f483880461591a5c67a9c859fbb925c 100644 (file)
@@ -29,7 +29,7 @@ type Cache struct {
        ValueToProgAfter []*obj.Prog
        debugState       debugState
 
-       Liveness interface{} // *gc.livenessFuncCache
+       Liveness any // *gc.livenessFuncCache
 
        // Free "headers" for use by the allocators in allocators.go.
        // Used to put slices in sync.Pools without allocation.
index ec0240941cfa21c54d893da98d6ac9db254477e6..3540db498cf3901c27ff70d585161650469f665b 100644 (file)
@@ -126,17 +126,17 @@ func (t *Types) SetTypPtrs() {
 
 type Logger interface {
        // Logf logs a message from the compiler.
-       Logf(string, ...interface{})
+       Logf(string, ...any)
 
        // Log reports whether logging is not a no-op
        // some logging calls account for more than a few heap allocations.
        Log() bool
 
        // Fatalf reports a compiler error and exits.
-       Fatalf(pos src.XPos, msg string, args ...interface{})
+       Fatalf(pos src.XPos, msg string, args ...any)
 
        // Warnl writes compiler messages in the form expected by "errorcheck" tests
-       Warnl(pos src.XPos, fmt_ string, args ...interface{})
+       Warnl(pos src.XPos, fmt_ string, args ...any)
 
        // Forwards the Debug flags from gc
        Debug_checknil() bool
index fe31b12191646d145742316e59d8d72e5039dbf4..20e548f7fc9d3e1ccb217417a159ea2f7ffa9a7b 100644 (file)
@@ -20,7 +20,7 @@ func BenchmarkCopyElim100000(b *testing.B) { benchmarkCopyElim(b, 100000) }
 func benchmarkCopyElim(b *testing.B, n int) {
        c := testConfig(b)
 
-       values := make([]interface{}, 0, n+2)
+       values := make([]any, 0, n+2)
        values = append(values, Valu("mem", OpInitMem, types.TypeMem, 0, nil))
        last := "mem"
        for i := 0; i < n; i++ {
index 7edc414bda7eb7ec5d3301ca03b21c6162257b3f..687abc42cc66cca92a9331f90c3bd33c3105defe 100644 (file)
@@ -195,7 +195,7 @@ type RegisterSet uint64
 // logf prints debug-specific logging to stdout (always stdout) if the
 // current function is tagged by GOSSAFUNC (for ssa output directed
 // either to stdout or html).
-func (s *debugState) logf(msg string, args ...interface{}) {
+func (s *debugState) logf(msg string, args ...any) {
        if s.f.PrintOrHtmlSSA {
                fmt.Printf(msg, args...)
        }
index 1e2a0df072f6dde315e2fec37b6808fc8245d1f6..8a5b364c2fd99f07ead880540e65dee671214a63 100644 (file)
@@ -951,7 +951,7 @@ func (x *expandState) indent(n int) {
 }
 
 // Printf does an indented fmt.Printf on the format and args.
-func (x *expandState) Printf(format string, a ...interface{}) (n int, err error) {
+func (x *expandState) Printf(format string, a ...any) (n int, err error) {
        if x.indentLevel > 0 {
                fmt.Printf("%[1]*s", x.indentLevel, "")
        }
index c33c77f891cc53bf7950b7756afe53880785a199..3ab0be7311338c3b6f2f07c6e27927924e07c7be 100644 (file)
@@ -98,12 +98,12 @@ func (TestFrontend) UseWriteBarrier() bool {
        return true // only writebarrier_test cares
 }
 
-func (d TestFrontend) Logf(msg string, args ...interface{}) { d.t.Logf(msg, args...) }
-func (d TestFrontend) Log() bool                            { return true }
+func (d TestFrontend) Logf(msg string, args ...any) { d.t.Logf(msg, args...) }
+func (d TestFrontend) Log() bool                    { return true }
 
-func (d TestFrontend) Fatalf(_ src.XPos, msg string, args ...interface{}) { d.t.Fatalf(msg, args...) }
-func (d TestFrontend) Warnl(_ src.XPos, msg string, args ...interface{})  { d.t.Logf(msg, args...) }
-func (d TestFrontend) Debug_checknil() bool                               { return false }
+func (d TestFrontend) Fatalf(_ src.XPos, msg string, args ...any) { d.t.Fatalf(msg, args...) }
+func (d TestFrontend) Warnl(_ src.XPos, msg string, args ...any)  { d.t.Logf(msg, args...) }
+func (d TestFrontend) Debug_checknil() bool                       { return false }
 
 func (d TestFrontend) Func() *ir.Func {
        return d.f
index fc8cb3f2fef0af845ea63c901e058662086918d4..56690c82843a33d82e3a00145b548397f8e37957 100644 (file)
@@ -336,7 +336,7 @@ func (f *Func) newValueNoBlock(op Op, t *types.Type, pos src.XPos) *Value {
 // context to allow item-by-item comparisons across runs.
 // For example:
 // awk 'BEGIN {FS="\t"} $3~/TIME/{sum+=$4} END{print "t(ns)=",sum}' t.log
-func (f *Func) LogStat(key string, args ...interface{}) {
+func (f *Func) LogStat(key string, args ...any) {
        value := ""
        for _, a := range args {
                value += fmt.Sprintf("\t%v", a)
@@ -729,12 +729,12 @@ func (f *Func) ConstOffPtrSP(t *types.Type, c int64, sp *Value) *Value {
        return v
 }
 
-func (f *Func) Frontend() Frontend                                  { return f.fe }
-func (f *Func) Warnl(pos src.XPos, msg string, args ...interface{}) { f.fe.Warnl(pos, msg, args...) }
-func (f *Func) Logf(msg string, args ...interface{})                { f.fe.Logf(msg, args...) }
-func (f *Func) Log() bool                                           { return f.fe.Log() }
+func (f *Func) Frontend() Frontend                          { return f.fe }
+func (f *Func) Warnl(pos src.XPos, msg string, args ...any) { f.fe.Warnl(pos, msg, args...) }
+func (f *Func) Logf(msg string, args ...any)                { f.fe.Logf(msg, args...) }
+func (f *Func) Log() bool                                   { return f.fe.Log() }
 
-func (f *Func) Fatalf(msg string, args ...interface{}) {
+func (f *Func) Fatalf(msg string, args ...any) {
        stats := "crashed"
        if f.Log() {
                f.Logf("  pass %s end %s\n", f.pass.name, stats)
index 4639d674e145fa38d54b37878e1c85f8a4763b13..1a378d4a95fb000c017a06424d847be8a4f02863 100644 (file)
@@ -206,7 +206,7 @@ func (c *Conf) Fun(entry string, blocs ...bloc) fun {
 // Bloc defines a block for Fun. The bloc name should be unique
 // across the containing Fun. entries should consist of calls to valu,
 // as well as one call to Goto, If, or Exit to specify the block kind.
-func Bloc(name string, entries ...interface{}) bloc {
+func Bloc(name string, entries ...any) bloc {
        b := bloc{}
        b.name = name
        seenCtrl := false
index 85a414f31e59f962d67e52ca2ff68fcf65148e4b..7a6683e9f01542ae06241bf6fb880a34721e8e85 100644 (file)
@@ -53,13 +53,13 @@ func NewHTMLWriter(path string, f *Func, cfgMask string) *HTMLWriter {
 }
 
 // Fatalf reports an error and exits.
-func (w *HTMLWriter) Fatalf(msg string, args ...interface{}) {
+func (w *HTMLWriter) Fatalf(msg string, args ...any) {
        fe := w.Func.Frontend()
        fe.Fatalf(src.NoXPos, msg, args...)
 }
 
 // Logf calls the (w *HTMLWriter).Func's Logf method passing along a msg and args.
-func (w *HTMLWriter) Logf(msg string, args ...interface{}) {
+func (w *HTMLWriter) Logf(msg string, args ...any) {
        w.Func.Logf(msg, args...)
 }
 
@@ -945,7 +945,7 @@ func (w *HTMLWriter) WriteMultiTitleColumn(phase string, titles []string, class,
        w.WriteString("</td>\n")
 }
 
-func (w *HTMLWriter) Printf(msg string, v ...interface{}) {
+func (w *HTMLWriter) Printf(msg string, v ...any) {
        if _, err := fmt.Fprintf(w.w, msg, v...); err != nil {
                w.Fatalf("%v", err)
        }
index 325118a1827b04c37f75521b7758385b1ff1d8e0..800625314530d773fea0cd556923a9ef6da29bbb 100644 (file)
@@ -36,13 +36,13 @@ type ValHeap struct {
 func (h ValHeap) Len() int      { return len(h.a) }
 func (h ValHeap) Swap(i, j int) { a := h.a; a[i], a[j] = a[j], a[i] }
 
-func (h *ValHeap) Push(x interface{}) {
+func (h *ValHeap) Push(x any) {
        // Push and Pop use pointer receivers because they modify the slice's length,
        // not just its contents.
        v := x.(*Value)
        h.a = append(h.a, v)
 }
-func (h *ValHeap) Pop() interface{} {
+func (h *ValHeap) Pop() any {
        old := h.a
        n := len(old)
        x := old[n-1]
index a27002ee3ac3b26a557decab61d33de604665398..766598ebd57ec4cd4e8d34b71080ae9252526574 100644 (file)
@@ -16,9 +16,9 @@ func TestSizeof(t *testing.T) {
        const _64bit = unsafe.Sizeof(uintptr(0)) == 8
 
        var tests = []struct {
-               val    interface{} // type as a value
-               _32bit uintptr     // size on 32bit platforms
-               _64bit uintptr     // size on 64bit platforms
+               val    any     // type as a value
+               _32bit uintptr // size on 32bit platforms
+               _64bit uintptr // size on 64bit platforms
        }{
                {Value{}, 72, 112},
                {Block{}, 164, 304},
index 51a70c7fd4fdcd35aa1ab12d997df0acfda21ad0..809ed6c85a1f2277f017d0e633cb620accc96a33 100644 (file)
@@ -471,9 +471,9 @@ func (v *Value) copyIntoWithXPos(b *Block, pos src.XPos) *Value {
        return c
 }
 
-func (v *Value) Logf(msg string, args ...interface{}) { v.Block.Logf(msg, args...) }
-func (v *Value) Log() bool                            { return v.Block.Log() }
-func (v *Value) Fatalf(msg string, args ...interface{}) {
+func (v *Value) Logf(msg string, args ...any) { v.Block.Logf(msg, args...) }
+func (v *Value) Log() bool                    { return v.Block.Log() }
+func (v *Value) Fatalf(msg string, args ...any) {
        v.Block.Func.fe.Fatalf(v.Pos, msg, args...)
 }
 
index 0dcf353bf4308932692a71f916b38194d0994518..4043ac457648e1e98a0e62db6f3c41be1b513d90 100644 (file)
@@ -396,11 +396,11 @@ type blockHeap struct {
 func (h *blockHeap) Len() int      { return len(h.a) }
 func (h *blockHeap) Swap(i, j int) { a := h.a; a[i], a[j] = a[j], a[i] }
 
-func (h *blockHeap) Push(x interface{}) {
+func (h *blockHeap) Push(x any) {
        v := x.(*ssa.Block)
        h.a = append(h.a, v)
 }
-func (h *blockHeap) Pop() interface{} {
+func (h *blockHeap) Pop() any {
        old := h.a
        n := len(old)
        x := old[n-1]
index ae7d57566f7e0defe86b3de2591e0dc739f00ed5..3dea733bbdbb7fb4c168af7995957e263117757b 100644 (file)
@@ -1115,13 +1115,13 @@ func (s *state) label(sym *types.Sym) *ssaLabel {
        return lab
 }
 
-func (s *state) Logf(msg string, args ...interface{}) { s.f.Logf(msg, args...) }
-func (s *state) Log() bool                            { return s.f.Log() }
-func (s *state) Fatalf(msg string, args ...interface{}) {
+func (s *state) Logf(msg string, args ...any) { s.f.Logf(msg, args...) }
+func (s *state) Log() bool                    { return s.f.Log() }
+func (s *state) Fatalf(msg string, args ...any) {
        s.f.Frontend().Fatalf(s.peekPos(), msg, args...)
 }
-func (s *state) Warnl(pos src.XPos, msg string, args ...interface{}) { s.f.Warnl(pos, msg, args...) }
-func (s *state) Debug_checknil() bool                                { return s.f.Frontend().Debug_checknil() }
+func (s *state) Warnl(pos src.XPos, msg string, args ...any) { s.f.Warnl(pos, msg, args...) }
+func (s *state) Debug_checknil() bool                        { return s.f.Frontend().Debug_checknil() }
 
 func ssaMarker(name string) *ir.Name {
        return ir.NewNameAt(base.Pos, &types.Sym{Name: name}, nil)
@@ -7714,7 +7714,7 @@ func (e *ssafn) SplitSlot(parent *ssa.LocalSlot, suffix string, offset int64, t
 }
 
 // Logf logs a message from the compiler.
-func (e *ssafn) Logf(msg string, args ...interface{}) {
+func (e *ssafn) Logf(msg string, args ...any) {
        if e.log {
                fmt.Printf(msg, args...)
        }
@@ -7725,15 +7725,15 @@ func (e *ssafn) Log() bool {
 }
 
 // Fatalf reports a compiler error and exits.
-func (e *ssafn) Fatalf(pos src.XPos, msg string, args ...interface{}) {
+func (e *ssafn) Fatalf(pos src.XPos, msg string, args ...any) {
        base.Pos = pos
-       nargs := append([]interface{}{ir.FuncName(e.curfn)}, args...)
+       nargs := append([]any{ir.FuncName(e.curfn)}, args...)
        base.Fatalf("'%s': "+msg, nargs...)
 }
 
 // Warnl reports a "warning", which is usually flag-triggered
 // logging output for the benefit of tests.
-func (e *ssafn) Warnl(pos src.XPos, fmt_ string, args ...interface{}) {
+func (e *ssafn) Warnl(pos src.XPos, fmt_ string, args ...any) {
        base.WarnfAt(pos, fmt_, args...)
 }
 
index 8b360176e86a4c23b238c3c5133daf35727b9517..3a2479bb8a1eab7a65eed3aaa49b4676e67ea1b2 100644 (file)
@@ -61,7 +61,7 @@ type block struct {
        lstmt  *LabeledStmt // labeled statement associated with this block, or nil
 }
 
-func (ls *labelScope) errf(pos Pos, format string, args ...interface{}) {
+func (ls *labelScope) errf(pos Pos, format string, args ...any) {
        ls.errh(Error{pos, fmt.Sprintf(format, args...)})
 }
 
index d5247886dae53117ccf5934cd53dd68d499ea4ec..9a021a4582903d23af4222226a91ffe1ddeb5149 100644 (file)
@@ -89,7 +89,7 @@ type writeError struct {
 }
 
 // printf is a convenience wrapper that takes care of print errors.
-func (p *dumper) printf(format string, args ...interface{}) {
+func (p *dumper) printf(format string, args ...any) {
        if _, err := fmt.Fprintf(p, format, args...); err != nil {
                panic(writeError{err})
        }
index d86d77e73f70ec57ab1da3a56e274ca85d45eb8a..86d93e8932d2b3f3ab844f48bc915b984f8ec464 100644 (file)
@@ -247,7 +247,7 @@ func mayCombine(prev token, next byte) (b bool) {
        // return
 }
 
-func (p *printer) print(args ...interface{}) {
+func (p *printer) print(args ...any) {
        for i := 0; i < len(args); i++ {
                switch x := args[i].(type) {
                case nil:
@@ -455,7 +455,7 @@ func (p *printer) printRawNode(n Node) {
                p.printExprList(n.ElemList)
 
        case *ArrayType:
-               var len interface{} = _DotDotDot
+               var len any = _DotDotDot
                if n.Len != nil {
                        len = n.Len
                }
index 807d8383866dcb80849c0d1daad89962b6d11c1c..700908f6bda28a5bb2e199480e15e679f3d60b3d 100644 (file)
@@ -50,12 +50,12 @@ func (s *scanner) init(src io.Reader, errh func(line, col uint, msg string), mod
 }
 
 // errorf reports an error at the most recently read character position.
-func (s *scanner) errorf(format string, args ...interface{}) {
+func (s *scanner) errorf(format string, args ...any) {
        s.error(fmt.Sprintf(format, args...))
 }
 
 // errorAtf reports an error at a byte column offset relative to the current token start.
-func (s *scanner) errorAtf(offset int, format string, args ...interface{}) {
+func (s *scanner) errorAtf(offset int, format string, args ...any) {
        s.errh(s.line, s.col+uint(offset), fmt.Sprintf(format, args...))
 }
 
index 83b102da9f564e72fe41dc8da27146aabd63699e..dd8f2b8200457185d693f1fc54fb0e3581cf4ed5 100644 (file)
@@ -36,7 +36,7 @@ type ErrorHandler func(err error)
 // A Pragma value augments a package, import, const, func, type, or var declaration.
 // Its meaning is entirely up to the PragmaHandler,
 // except that nil is used to mean “no pragma seen.”
-type Pragma interface{}
+type Pragma any
 
 // A PragmaHandler is used to process //go: directives while scanning.
 // It is passed the current pragma value, which starts out being nil,
index 8ff7a60aae66dc92c34c10acb902652d04eee481..b6d3e248ad0c1dedebdc1fb7e24fd11d1d69e87e 100644 (file)
@@ -24,7 +24,7 @@ func makeT() T {
 
 var g T
 
-var sink interface{}
+var sink any
 
 func TestIssue15854(t *testing.T) {
        for i := 0; i < 10000; i++ {
index db41eb8e55c740c36652ae1c739779bac928168a..cb7dc70c2ff89380285b8af9dc7e90a7a9dd561d 100644 (file)
@@ -13,7 +13,7 @@ var x int
 
 func TestEfaceConv1(t *testing.T) {
        a := 5
-       i := interface{}(a)
+       i := any(a)
        a += 2
        if got := i.(int); got != 5 {
                t.Errorf("wanted 5, got %d\n", got)
@@ -23,7 +23,7 @@ func TestEfaceConv1(t *testing.T) {
 func TestEfaceConv2(t *testing.T) {
        a := 5
        sink = &a
-       i := interface{}(a)
+       i := any(a)
        a += 2
        if got := i.(int); got != 5 {
                t.Errorf("wanted 5, got %d\n", got)
@@ -38,7 +38,7 @@ func TestEfaceConv3(t *testing.T) {
 }
 
 //go:noinline
-func e2int3(i interface{}) int {
+func e2int3(i any) int {
        x = 7
        return i.(int)
 }
@@ -51,7 +51,7 @@ func TestEfaceConv4(t *testing.T) {
 }
 
 //go:noinline
-func e2int4(i interface{}, p *int) int {
+func e2int4(i any, p *int) int {
        *p = 7
        return i.(int)
 }
@@ -69,7 +69,7 @@ func (i Int) foo() {
 
 func TestIfaceConv1(t *testing.T) {
        a := Int(5)
-       i := interface{}(a)
+       i := any(a)
        a += 2
        if got := i.(Int); got != 5 {
                t.Errorf("wanted 5, got %d\n", int(got))
@@ -79,7 +79,7 @@ func TestIfaceConv1(t *testing.T) {
 func TestIfaceConv2(t *testing.T) {
        a := Int(5)
        sink = &a
-       i := interface{}(a)
+       i := any(a)
        a += 2
        if got := i.(Int); got != 5 {
                t.Errorf("wanted 5, got %d\n", int(got))
@@ -121,7 +121,7 @@ func BenchmarkEfaceInteger(b *testing.B) {
 }
 
 //go:noinline
-func i2int(i interface{}) int {
+func i2int(i any) int {
        return i.(int)
 }
 
index 492379e188c01acf7acefcc292bed756a63180af..d540f25c73a217eeef207fc0d18daff55c9a4fe9 100644 (file)
@@ -916,7 +916,7 @@ func TestShiftGeneric(t *testing.T) {
                signed     bool
                shiftWidth int
                left       bool
-               f          interface{}
+               f          any
        }{
                {64, true, 64, true, func(n int64, s uint64) int64 { return n << s }},
                {64, true, 64, false, func(n int64, s uint64) int64 { return n >> s }},
index c97220e6c23291301dd8105144d69fc6b849f134..d7aad9c6b96f60225c331f4fb2055770b4731af2 100644 (file)
@@ -713,7 +713,7 @@ func implicitstar(n ir.Node) ir.Node {
        return Expr(star)
 }
 
-func needOneArg(n *ir.CallExpr, f string, args ...interface{}) (ir.Node, bool) {
+func needOneArg(n *ir.CallExpr, f string, args ...any) (ir.Node, bool) {
        if len(n.Args) == 0 {
                p := fmt.Sprintf(f, args...)
                base.Errorf("missing argument to %s: %v", p, n)
index 67e2e99f02f5fd4747db651ae19def3693f0ac13..848720ee89686abad1544588408cb846b09dea84 100644 (file)
@@ -183,7 +183,7 @@ var BasicTypeNames = []string{
 }
 
 var fmtBufferPool = sync.Pool{
-       New: func() interface{} {
+       New: func() any {
                return new(bytes.Buffer)
        },
 }
index ba033ec499b086dc02a8dce0dabc0c24700559e8..1b80659c8edb0ba6212144bf76b6c55cc34c6638 100644 (file)
@@ -16,9 +16,9 @@ func TestSizeof(t *testing.T) {
        const _64bit = unsafe.Sizeof(uintptr(0)) == 8
 
        var tests = []struct {
-               val    interface{} // type as a value
-               _32bit uintptr     // size on 32bit platforms
-               _64bit uintptr     // size on 64bit platforms
+               val    any     // type as a value
+               _32bit uintptr // size on 32bit platforms
+               _64bit uintptr // size on 64bit platforms
        }{
                {Sym{}, 32, 64},
                {Type{}, 60, 96},
index da859290f7a2564fb4978b2d2bd03a0c68e58261..8de589bae3533378a862e3713ba87476f9620819 100644 (file)
@@ -174,7 +174,7 @@ type Type struct {
        // TARRAY: *Array
        // TSLICE: Slice
        // TSSA: string
-       extra interface{}
+       extra any
 
        // width is the width of this Type in bytes.
        width int64 // valid if Align > 0
index 8b27d9d3c10b2255920327f32f3cc27a1c01e349..77c59451fd628dbd354c6221bbb3c6a97d123031 100644 (file)
@@ -118,7 +118,7 @@ type action struct {
 
 // If debug is set, describef sets a printf-formatted description for action a.
 // Otherwise, it is a no-op.
-func (a *action) describef(pos poser, format string, args ...interface{}) {
+func (a *action) describef(pos poser, format string, args ...any) {
        if debug {
                a.desc = &actionDesc{pos, format, args}
        }
@@ -129,7 +129,7 @@ func (a *action) describef(pos poser, format string, args ...interface{}) {
 type actionDesc struct {
        pos    poser
        format string
-       args   []interface{}
+       args   []any
 }
 
 // A Checker maintains the state of the type checker.
index 44f2adc7b79f09f2448aecb51c1dd6071ce48a68..e2f5508a1a430c00aa85a22aa07ab3a2035183b2 100644 (file)
@@ -56,7 +56,7 @@ func (check *Checker) newError(code Code) *error_ {
 // Subsequent calls to addf provide additional information in the form of additional lines
 // in the error message (types2) or continuation errors identified by a tab-indented error
 // message (go/types).
-func (err *error_) addf(at poser, format string, args ...interface{}) {
+func (err *error_) addf(at poser, format string, args ...any) {
        err.desc = append(err.desc, errorDesc{atPos(at), err.check.sprintf(format, args...)})
 }
 
index d62b0247578d6e5b800a505b4f1974f46d7c95c1..39bf4055a3718967bd7f29d8fb10875da5cd3433 100644 (file)
@@ -1247,7 +1247,7 @@ Error:
 // represented as an integer (such as 1.0) it is returned as an integer value.
 // This ensures that constants of different kind but equal value (such as
 // 1.0 + 0i, 1.0, 1) result in the same value.
-func keyVal(x constant.Value) interface{} {
+func keyVal(x constant.Value) any {
        switch x.Kind() {
        case constant.Complex:
                f := constant.ToFloat(x)
index df8a3e7d78af57e4a384838a17bd5bbca4055cbb..6cc0974c3344be3142d891e35766b691dad10c6f 100644 (file)
@@ -68,7 +68,7 @@ type gen struct {
        bytes.Buffer
 }
 
-func (g *gen) p(format string, args ...interface{}) {
+func (g *gen) p(format string, args ...any) {
        fmt.Fprintf(&g.Buffer, format, args...)
 }
 
index 13b96209114de1e769a3c31ca4d280e9bb49335f..092e82318a30960e9ba6fd40a5add79185c42564 100644 (file)
@@ -15,9 +15,9 @@ func TestSizeof(t *testing.T) {
        const _64bit = ^uint(0)>>32 != 0
 
        var tests = []struct {
-               val    interface{} // type as a value
-               _32bit uintptr     // size on 32bit platforms
-               _64bit uintptr     // size on 64bit platforms
+               val    any     // type as a value
+               _32bit uintptr // size on 32bit platforms
+               _64bit uintptr // size on 64bit platforms
        }{
                // Types
                {Basic{}, 16, 32},
index a579c8184e3e14c8495a66dd9e13bc2a19acce51..f778a01a7adb0723eddd140a443aaff6d70daaed 100644 (file)
@@ -460,7 +460,7 @@ func pkgFilenames(dir string, includeTest bool) ([]string, error) {
        return filenames, nil
 }
 
-func walkPkgDirs(dir string, pkgh func(dir string, filenames []string), errh func(args ...interface{})) {
+func walkPkgDirs(dir string, pkgh func(dir string, filenames []string), errh func(args ...any)) {
        w := walker{pkgh, errh}
        w.walk(dir)
 }
index efe9c99d87625f4808ce98de703e2bc756f8b641..47ca4d90ec7a3b3996d6a1ece3d9ecc4b04ce7ee 100644 (file)
@@ -192,7 +192,7 @@ func (check *Checker) suspendedCall(keyword string, call syntax.Expr) {
 }
 
 // goVal returns the Go value for val, or nil.
-func goVal(val constant.Value) interface{} {
+func goVal(val constant.Value) any {
        // val should exist, but be conservative and check
        if val == nil {
                return nil
@@ -226,7 +226,7 @@ func goVal(val constant.Value) interface{} {
 // types we need to also check the value's types (e.g., byte(1) vs myByte(1))
 // when the switch expression is of interface type.
 type (
-       valueMap  map[interface{}][]valueType // underlying Go value -> valueType
+       valueMap  map[any][]valueType // underlying Go value -> valueType
        valueType struct {
                pos syntax.Pos
                typ Type
index f4f24f4d1b7ec0612bbc0bfaf41d33bbd1c8a67d..7250d82478e6e27df3c0801183d8feef54d314f2 100644 (file)
@@ -141,7 +141,7 @@ func (u *unifier) unify(x, y Type, mode unifyMode) bool {
        return u.nify(x, y, mode, nil)
 }
 
-func (u *unifier) tracef(format string, args ...interface{}) {
+func (u *unifier) tracef(format string, args ...any) {
        fmt.Println(strings.Repeat(".  ", u.depth) + sprintf(nil, true, format, args...))
 }
 
index 765b0f7e9aba4421f211944341a0e5c453b8eb40..512285055c6da7d36ba3340b893690fbf33b175e 100644 (file)
@@ -58,7 +58,7 @@ func (check *Checker) allowVersion(want goVersion) bool {
 
 // verifyVersionf is like allowVersion but also accepts a format string and arguments
 // which are used to report a version error if allowVersion returns false.
-func (check *Checker) verifyVersionf(at poser, v goVersion, format string, args ...interface{}) bool {
+func (check *Checker) verifyVersionf(at poser, v goVersion, format string, args ...any) bool {
        if !check.allowVersion(v) {
                check.versionErrorf(at, v, format, args...)
                return false
index 122ad28b5cafce6e2753e71f8ebf0afa440d0e32..b88b81799e6cdacabfa4abc3416901bd8b227190 100644 (file)
@@ -42,14 +42,14 @@ func Exit(code int) {
        os.Exit(code)
 }
 
-func dbgtrace(vlevel int, s string, a ...interface{}) {
+func dbgtrace(vlevel int, s string, a ...any) {
        if *verbflag >= vlevel {
                fmt.Printf(s, a...)
                fmt.Printf("\n")
        }
 }
 
-func warn(s string, a ...interface{}) {
+func warn(s string, a ...any) {
        fmt.Fprintf(os.Stderr, "warning: ")
        fmt.Fprintf(os.Stderr, s, a...)
        fmt.Fprintf(os.Stderr, "\n")
@@ -58,7 +58,7 @@ func warn(s string, a ...interface{}) {
        }
 }
 
-func fatal(s string, a ...interface{}) {
+func fatal(s string, a ...any) {
        fmt.Fprintf(os.Stderr, "error: ")
        fmt.Fprintf(os.Stderr, s, a...)
        fmt.Fprintf(os.Stderr, "\n")
index 9c9e1b85f0cd76d59b8d99692adcb59040a96611..15cfcccec38329f23f8e8c2e86311622ccfc4e31 100644 (file)
@@ -1108,7 +1108,7 @@ func (t *tester) registerTest(heading string, test *goTest, opts ...registerTest
 // dirCmd constructs a Cmd intended to be run in the foreground.
 // The command will be run in dir, and Stdout and Stderr will go to os.Stdout
 // and os.Stderr.
-func (t *tester) dirCmd(dir string, cmdline ...interface{}) *exec.Cmd {
+func (t *tester) dirCmd(dir string, cmdline ...any) *exec.Cmd {
        bin, args := flattenCmdline(cmdline)
        cmd := exec.Command(bin, args...)
        if filepath.IsAbs(dir) {
@@ -1126,7 +1126,7 @@ func (t *tester) dirCmd(dir string, cmdline ...interface{}) *exec.Cmd {
 
 // flattenCmdline flattens a mixture of string and []string as single list
 // and then interprets it as a command line: first element is binary, then args.
-func flattenCmdline(cmdline []interface{}) (bin string, args []string) {
+func flattenCmdline(cmdline []any) (bin string, args []string) {
        var list []string
        for _, x := range cmdline {
                switch x := x.(type) {
index 121c2dc62cf7a4bda117820c6fa23d81d3dc758f..1109bf0efd7a1e5e9a7a0fff84e17b2099a1a25c 100644 (file)
@@ -21,7 +21,7 @@ import (
 
 // pathf is fmt.Sprintf for generating paths
 // (on windows it turns / into \ after the printf).
-func pathf(format string, args ...interface{}) string {
+func pathf(format string, args ...any) string {
        return filepath.Clean(fmt.Sprintf(format, args...))
 }
 
@@ -324,7 +324,7 @@ func xworkdir() string {
 }
 
 // fatalf prints an error message to standard error and exits.
-func fatalf(format string, args ...interface{}) {
+func fatalf(format string, args ...any) {
        fmt.Fprintf(os.Stderr, "go tool dist: %s\n", fmt.Sprintf(format, args...))
 
        dieOnce.Do(func() { close(dying) })
@@ -353,12 +353,12 @@ func xatexit(f func()) {
 }
 
 // xprintf prints a message to standard output.
-func xprintf(format string, args ...interface{}) {
+func xprintf(format string, args ...any) {
        fmt.Printf(format, args...)
 }
 
 // errprintf prints a message to standard output.
-func errprintf(format string, args ...interface{}) {
+func errprintf(format string, args ...any) {
        fmt.Fprintf(os.Stderr, format, args...)
 }
 
index 3998ce11726fe027a6e7806db59557d8978c3c20..0ec4102cc61cd0faa9d2e66a616e9ba3ef986359 100644 (file)
@@ -268,7 +268,7 @@ func (e *invalidImportError) Unwrap() error {
 // 1.20, preventing unnecessary go.sum churn and network access in those
 // modules.
 func importFromModules(loaderstate *State, ctx context.Context, path string, rs *Requirements, mg *ModuleGraph, skipModFile bool) (m module.Version, modroot, dir string, altMods []module.Version, err error) {
-       invalidf := func(format string, args ...interface{}) (module.Version, string, string, []module.Version, error) {
+       invalidf := func(format string, args ...any) (module.Version, string, string, []module.Version, error) {
                return module.Version{}, "", "", nil, &invalidImportError{
                        importPath: path,
                        err:        fmt.Errorf(format, args...),
index e0e063445957dbaa7baf01c66de53385fec21092..f9fd52293071cb2b3feb16fd68d047b713768797 100644 (file)
@@ -145,14 +145,14 @@ func (r *CovDataReader) Visit() error {
        return nil
 }
 
-func (r *CovDataReader) verb(vlevel int, s string, a ...interface{}) {
+func (r *CovDataReader) verb(vlevel int, s string, a ...any) {
        if r.verbosityLevel >= vlevel {
                fmt.Fprintf(os.Stderr, s, a...)
                fmt.Fprintf(os.Stderr, "\n")
        }
 }
 
-func (r *CovDataReader) warn(s string, a ...interface{}) {
+func (r *CovDataReader) warn(s string, a ...any) {
        fmt.Fprintf(os.Stderr, "warning: ")
        fmt.Fprintf(os.Stderr, s, a...)
        fmt.Fprintf(os.Stderr, "\n")
@@ -161,7 +161,7 @@ func (r *CovDataReader) warn(s string, a ...interface{}) {
        }
 }
 
-func (r *CovDataReader) fatal(s string, a ...interface{}) error {
+func (r *CovDataReader) fatal(s string, a ...any) error {
        if r.err != nil {
                return nil
        }
index 6e06f139b03d31f06e96784a1aabe57968d34cab..b8956b4cffe8d0ebf2e79f57a53e969a99b853b7 100644 (file)
@@ -40,8 +40,7 @@ const AbstractFuncSuffix = "$abstract"
 var logDwarf bool
 
 // Sym represents a symbol.
-type Sym interface {
-}
+type Sym any
 
 // A Var represents a local variable or a function parameter.
 type Var struct {
@@ -194,16 +193,16 @@ type Context interface {
        Size(s Sym) int64
        AddInt(s Sym, size int, i int64)
        AddBytes(s Sym, b []byte)
-       AddAddress(s Sym, t interface{}, ofs int64)
-       AddCURelativeAddress(s Sym, t interface{}, ofs int64)
-       AddSectionOffset(s Sym, size int, t interface{}, ofs int64)
-       AddDWARFAddrSectionOffset(s Sym, t interface{}, ofs int64)
-       AddIndirectTextRef(s Sym, t interface{})
+       AddAddress(s Sym, t any, ofs int64)
+       AddCURelativeAddress(s Sym, t any, ofs int64)
+       AddSectionOffset(s Sym, size int, t any, ofs int64)
+       AddDWARFAddrSectionOffset(s Sym, t any, ofs int64)
+       AddIndirectTextRef(s Sym, t any)
        CurrentOffset(s Sym) int64
        RecordDclReference(from Sym, to Sym, dclIdx int, inlIndex int)
        RecordChildDieOffsets(s Sym, vars []*Var, offsets []int32)
        AddString(s Sym, v string)
-       Logf(format string, args ...interface{})
+       Logf(format string, args ...any)
 }
 
 // AppendUleb128 appends v to b using DWARF's unsigned LEB128 encoding.
@@ -874,7 +873,7 @@ type DWAttr struct {
        Atr   uint16 // DW_AT_
        Cls   uint8  // DW_CLS_
        Value int64
-       Data  interface{}
+       Data  any
 }
 
 // DWDie represents a DWARF debug info entry.
@@ -886,7 +885,7 @@ type DWDie struct {
        Sym    Sym
 }
 
-func putattr(ctxt Context, s Sym, abbrev int, form int, cls int, value int64, data interface{}) error {
+func putattr(ctxt Context, s Sym, abbrev int, form int, cls int, value int64, data any) error {
        switch form {
        case DW_FORM_addr: // address
                // Allow nil addresses for DW_AT_go_runtime_type.
index ad29c32c50a8decaea11b8154856f57f825b24f6..6c9907dbb487f27097d29b6cec1da66bc0673a04 100644 (file)
@@ -100,7 +100,7 @@ func (r *LoadCmdReader) Next() (LoadCmd, error) {
        return cmd, nil
 }
 
-func (r LoadCmdReader) ReadAt(offset int64, data interface{}) error {
+func (r LoadCmdReader) ReadAt(offset int64, data any) error {
        if _, err := r.f.Seek(r.offset+offset, 0); err != nil {
                return err
        }
@@ -117,7 +117,7 @@ func NewLoadCmdUpdater(f io.ReadWriteSeeker, order binary.ByteOrder, nextOffset
        return LoadCmdUpdater{NewLoadCmdReader(f, order, nextOffset)}
 }
 
-func (u LoadCmdUpdater) WriteAt(offset int64, data interface{}) error {
+func (u LoadCmdUpdater) WriteAt(offset int64, data any) error {
        if _, err := u.f.Seek(u.offset+offset, 0); err != nil {
                return err
        }
index 670b0f3510f8c257ae012dd3a6dc760499e83471..d09aa985f046688e7f049f65bb0e5224cc65961c 100644 (file)
@@ -231,7 +231,7 @@ func (c dwCtxt) AddString(s dwarf.Sym, v string) {
        ls.WriteString(c.Link, ls.Size, len(v), v)
        ls.WriteInt(c.Link, ls.Size, 1, 0)
 }
-func (c dwCtxt) AddAddress(s dwarf.Sym, data interface{}, value int64) {
+func (c dwCtxt) AddAddress(s dwarf.Sym, data any, value int64) {
        ls := s.(*LSym)
        size := c.PtrSize()
        if data != nil {
@@ -241,15 +241,15 @@ func (c dwCtxt) AddAddress(s dwarf.Sym, data interface{}, value int64) {
                ls.WriteInt(c.Link, ls.Size, size, value)
        }
 }
-func (c dwCtxt) AddCURelativeAddress(s dwarf.Sym, data interface{}, value int64) {
+func (c dwCtxt) AddCURelativeAddress(s dwarf.Sym, data any, value int64) {
        ls := s.(*LSym)
        rsym := data.(*LSym)
        ls.WriteCURelativeAddr(c.Link, ls.Size, rsym, value)
 }
-func (c dwCtxt) AddSectionOffset(s dwarf.Sym, size int, t interface{}, ofs int64) {
+func (c dwCtxt) AddSectionOffset(s dwarf.Sym, size int, t any, ofs int64) {
        panic("should be used only in the linker")
 }
-func (c dwCtxt) AddDWARFAddrSectionOffset(s dwarf.Sym, t interface{}, ofs int64) {
+func (c dwCtxt) AddDWARFAddrSectionOffset(s dwarf.Sym, t any, ofs int64) {
        size := 4
        if isDwarf64(c.Link) {
                size = 8
@@ -284,11 +284,11 @@ func (c dwCtxt) RecordChildDieOffsets(s dwarf.Sym, vars []*dwarf.Var, offsets []
        c.Link.DwFixups.RegisterChildDIEOffsets(ls, vars, offsets)
 }
 
-func (c dwCtxt) Logf(format string, args ...interface{}) {
+func (c dwCtxt) Logf(format string, args ...any) {
        c.Link.Logf(format, args...)
 }
 
-func (c dwCtxt) AddIndirectTextRef(s dwarf.Sym, t interface{}) {
+func (c dwCtxt) AddIndirectTextRef(s dwarf.Sym, t any) {
        ls := s.(*LSym)
        tsym := t.(*LSym)
        // Note the doubling below -- DwTextCount is an estimate and
index 9f3814e748aa5fec79909659cf5996c376f0c37d..85dca33d2773ecdc19e7cf3b6d4a650ea2f3f5ee 100644 (file)
@@ -211,7 +211,7 @@ type Addr struct {
        //      for TYPE_FCONST, a float64
        //      for TYPE_BRANCH, a *Prog (optional)
        //      for TYPE_TEXTSIZE, an int32 (optional)
-       Val interface{}
+       Val any
 }
 
 type AddrName int8
@@ -464,7 +464,7 @@ type LSym struct {
        P      []byte
        R      []Reloc
 
-       Extra *interface{} // *FuncInfo, *VarInfo, *FileInfo, *TypeInfo, or *ItabInfo, if present
+       Extra *any // *FuncInfo, *VarInfo, *FileInfo, *TypeInfo, or *ItabInfo, if present
 
        Pkg    string
        PkgIdx int32
@@ -523,7 +523,7 @@ func (s *LSym) NewFuncInfo() *FuncInfo {
                panic(fmt.Sprintf("invalid use of LSym - NewFuncInfo with Extra of type %T", *s.Extra))
        }
        f := new(FuncInfo)
-       s.Extra = new(interface{})
+       s.Extra = new(any)
        *s.Extra = f
        return f
 }
@@ -547,7 +547,7 @@ func (s *LSym) NewVarInfo() *VarInfo {
                panic(fmt.Sprintf("invalid use of LSym - NewVarInfo with Extra of type %T", *s.Extra))
        }
        f := new(VarInfo)
-       s.Extra = new(interface{})
+       s.Extra = new(any)
        *s.Extra = f
        return f
 }
@@ -574,7 +574,7 @@ func (s *LSym) NewFileInfo() *FileInfo {
                panic(fmt.Sprintf("invalid use of LSym - NewFileInfo with Extra of type %T", *s.Extra))
        }
        f := new(FileInfo)
-       s.Extra = new(interface{})
+       s.Extra = new(any)
        *s.Extra = f
        return f
 }
@@ -591,7 +591,7 @@ func (s *LSym) File() *FileInfo {
 // A TypeInfo contains information for a symbol
 // that contains a runtime._type.
 type TypeInfo struct {
-       Type interface{} // a *cmd/compile/internal/types.Type
+       Type any // a *cmd/compile/internal/types.Type
 }
 
 func (s *LSym) NewTypeInfo() *TypeInfo {
@@ -599,7 +599,7 @@ func (s *LSym) NewTypeInfo() *TypeInfo {
                panic(fmt.Sprintf("invalid use of LSym - NewTypeInfo with Extra of type %T", *s.Extra))
        }
        t := new(TypeInfo)
-       s.Extra = new(interface{})
+       s.Extra = new(any)
        *s.Extra = t
        return t
 }
@@ -616,7 +616,7 @@ func (s *LSym) TypeInfo() *TypeInfo {
 // An ItabInfo contains information for a symbol
 // that contains a runtime.itab.
 type ItabInfo struct {
-       Type interface{} // a *cmd/compile/internal/types.Type
+       Type any // a *cmd/compile/internal/types.Type
 }
 
 func (s *LSym) NewItabInfo() *ItabInfo {
@@ -624,7 +624,7 @@ func (s *LSym) NewItabInfo() *ItabInfo {
                panic(fmt.Sprintf("invalid use of LSym - NewItabInfo with Extra of type %T", *s.Extra))
        }
        t := new(ItabInfo)
-       s.Extra = new(interface{})
+       s.Extra = new(any)
        *s.Extra = t
        return t
 }
@@ -1178,7 +1178,7 @@ type Link struct {
        DwFixups           *DwarfFixupTable
        DwTextCount        int
        Imports            []goobj.ImportedPkg
-       DiagFunc           func(string, ...interface{})
+       DiagFunc           func(string, ...any)
        DiagFlush          func()
        DebugInfo          func(ctxt *Link, fn *LSym, info *LSym, curfn Func) ([]dwarf.Scope, dwarf.InlCalls)
        GenAbstractFunc    func(fn *LSym)
@@ -1223,12 +1223,12 @@ func _(ctxt *Link) {
        }
 }
 
-func (ctxt *Link) Diag(format string, args ...interface{}) {
+func (ctxt *Link) Diag(format string, args ...any) {
        ctxt.Errors++
        ctxt.DiagFunc(format, args...)
 }
 
-func (ctxt *Link) Logf(format string, args ...interface{}) {
+func (ctxt *Link) Logf(format string, args ...any) {
        fmt.Fprintf(ctxt.Bso, format, args...)
        ctxt.Bso.Flush()
 }
index e0aca15005a94927c22d9615d8ee5795690110ef..53cea8d37c29e407ddd516a18690be4ebaebc9a1 100644 (file)
@@ -1340,7 +1340,7 @@ func opset(a, b0 obj.As) {
 
 func buildop(ctxt *obj.Link) {
        if ctxt.DiagFunc == nil {
-               ctxt.DiagFunc = func(format string, args ...interface{}) {
+               ctxt.DiagFunc = func(format string, args ...any) {
                        log.Printf(format, args...)
                }
        }
index 67a078091c54b640c003257bfa867d27eb093076..1cfcde7aa5b60df36e12b04bdbb1cccac42f7438 100644 (file)
@@ -22,7 +22,7 @@ import (
 //
 // where func is the function, val is the current value, p is the instruction being
 // considered, and arg can be used to further parameterize valfunc.
-func funcpctab(ctxt *Link, func_ *LSym, desc string, valfunc func(*Link, *LSym, int32, *Prog, int32, interface{}) int32, arg interface{}) *LSym {
+func funcpctab(ctxt *Link, func_ *LSym, desc string, valfunc func(*Link, *LSym, int32, *Prog, int32, any) int32, arg any) *LSym {
        dbg := desc == ctxt.Debugpcln
        dst := []byte{}
        sym := &LSym{
@@ -138,7 +138,7 @@ func funcpctab(ctxt *Link, func_ *LSym, desc string, valfunc func(*Link, *LSym,
 // or the line number (arg == 1) to use at p.
 // Because p.Pos applies to p, phase == 0 (before p)
 // takes care of the update.
-func pctofileline(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg interface{}) int32 {
+func pctofileline(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg any) int32 {
        if p.As == ATEXT || p.As == ANOP || p.Pos.Line() == 0 || phase == 1 {
                return oldval
        }
@@ -198,7 +198,7 @@ func (s *pcinlineState) setParentPC(ctxt *Link, globalIndex int, pc int32) {
 // pctoinline computes the index into the local inlining tree to use at p.
 // If p is not the result of inlining, pctoinline returns -1. Because p.Pos
 // applies to p, phase == 0 (before p) takes care of the update.
-func (s *pcinlineState) pctoinline(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg interface{}) int32 {
+func (s *pcinlineState) pctoinline(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg any) int32 {
        if phase == 1 {
                return oldval
        }
@@ -224,7 +224,7 @@ func (s *pcinlineState) pctoinline(ctxt *Link, sym *LSym, oldval int32, p *Prog,
 // It is oldval plus any adjustment made by p itself.
 // The adjustment by p takes effect only after p, so we
 // apply the change during phase == 1.
-func pctospadj(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg interface{}) int32 {
+func pctospadj(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg any) int32 {
        if oldval == -1 { // starting
                oldval = 0
        }
@@ -245,7 +245,7 @@ func pctospadj(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg in
 // non-PCDATA instructions.
 // Since PCDATA instructions have no width in the final code,
 // it does not matter which phase we use for the update.
-func pctopcdata(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg interface{}) int32 {
+func pctopcdata(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg any) int32 {
        if phase == 0 || p.As != APCDATA || p.From.Offset != int64(arg.(uint32)) {
                return oldval
        }
@@ -337,7 +337,7 @@ func linkpcln(ctxt *Link, cursym *LSym) {
                                Attribute: AttrContentAddressable | AttrPcdata,
                        }
                } else {
-                       pcln.Pcdata[i] = funcpctab(ctxt, cursym, "pctopcdata", pctopcdata, interface{}(uint32(i)))
+                       pcln.Pcdata[i] = funcpctab(ctxt, cursym, "pctopcdata", pctopcdata, any(uint32(i)))
                }
        }
 
index ab7af2205e64c3be01ed2ef0da53ebf7720be1ca..9f1acf4b62e2ee438ed0a59c3ffd22b983fb9644 100644 (file)
@@ -439,7 +439,7 @@ func TestAddrClassifier(t *testing.T) {
        }
        tsts := [...]struct {
                arg    obj.Addr
-               output interface{}
+               output any
        }{
                // Supported register type args
                {obj.Addr{Type: obj.TYPE_REG, Reg: REG_R1}, C_REG},
index 69e60473f50ac8ba626576b08a2e0c49a5f4e3d8..fdee114f5b45a79e06e86dde40153303273ae995 100644 (file)
@@ -16,9 +16,9 @@ func TestSizeof(t *testing.T) {
        const _64bit = unsafe.Sizeof(uintptr(0)) == 8
 
        var tests = []struct {
-               val    interface{} // type as a value
-               _32bit uintptr     // size on 32bit platforms
-               _64bit uintptr     // size on 64bit platforms
+               val    any     // type as a value
+               _32bit uintptr // size on 32bit platforms
+               _64bit uintptr // size on 64bit platforms
        }{
                {Addr{}, 32, 48},
                {LSym{}, 72, 120},
index 8709c4e5cf530e141a799f206f85256d07e1e85b..32d71d05751dd6599ee4a1a4f6fd7d64c9be6ce1 100644 (file)
@@ -85,7 +85,7 @@ var buildID string // filled in by linker
 type versionFlag struct{}
 
 func (versionFlag) IsBoolFlag() bool { return true }
-func (versionFlag) Get() interface{} { return nil }
+func (versionFlag) Get() any         { return nil }
 func (versionFlag) String() string   { return "" }
 func (versionFlag) Set(s string) error {
        name := os.Args[0]
@@ -148,7 +148,7 @@ func (c *count) Set(s string) error {
        return nil
 }
 
-func (c *count) Get() interface{} {
+func (c *count) Get() any {
        return int(*c)
 }
 
@@ -206,8 +206,8 @@ func DecodeArg(arg string) string {
 type debugField struct {
        name         string
        help         string
-       concurrentOk bool        // true if this field/flag is compatible with concurrent compilation
-       val          interface{} // *int or *string
+       concurrentOk bool // true if this field/flag is compatible with concurrent compilation
+       val          any  // *int or *string
 }
 
 type DebugFlag struct {
@@ -234,7 +234,7 @@ type DebugSSA func(phase, flag string, val int, valString string) string
 //
 // If debugSSA is non-nil, any debug flags of the form ssa/... will be
 // passed to debugSSA for processing.
-func NewDebugFlag(debug interface{}, debugSSA DebugSSA) *DebugFlag {
+func NewDebugFlag(debug any, debugSSA DebugSSA) *DebugFlag {
        flag := &DebugFlag{
                tab:      make(map[string]debugField),
                debugSSA: debugSSA,
index 222e712edeb608e758b8794e3c7ed30bda6f185b..31de34aff451bfe1267540611c1812ce1fc5d6e1 100644 (file)
@@ -100,7 +100,7 @@ func (c dwctxt) AddString(s dwarf.Sym, v string) {
        dsu.Addstring(v)
 }
 
-func (c dwctxt) AddAddress(s dwarf.Sym, data interface{}, value int64) {
+func (c dwctxt) AddAddress(s dwarf.Sym, data any, value int64) {
        ds := loader.Sym(s.(dwSym))
        dsu := c.ldr.MakeSymbolUpdater(ds)
        if value != 0 {
@@ -110,7 +110,7 @@ func (c dwctxt) AddAddress(s dwarf.Sym, data interface{}, value int64) {
        dsu.AddAddrPlus(c.arch, tgtds, value)
 }
 
-func (c dwctxt) AddCURelativeAddress(s dwarf.Sym, data interface{}, value int64) {
+func (c dwctxt) AddCURelativeAddress(s dwarf.Sym, data any, value int64) {
        ds := loader.Sym(s.(dwSym))
        dsu := c.ldr.MakeSymbolUpdater(ds)
        if value != 0 {
@@ -120,7 +120,7 @@ func (c dwctxt) AddCURelativeAddress(s dwarf.Sym, data interface{}, value int64)
        dsu.AddCURelativeAddrPlus(c.arch, tgtds, value)
 }
 
-func (c dwctxt) AddSectionOffset(s dwarf.Sym, size int, t interface{}, ofs int64) {
+func (c dwctxt) AddSectionOffset(s dwarf.Sym, size int, t any, ofs int64) {
        ds := loader.Sym(s.(dwSym))
        dsu := c.ldr.MakeSymbolUpdater(ds)
        tds := loader.Sym(t.(dwSym))
@@ -132,7 +132,7 @@ func (c dwctxt) AddSectionOffset(s dwarf.Sym, size int, t interface{}, ofs int64
        dsu.AddSymRef(c.arch, tds, ofs, objabi.R_ADDROFF, size)
 }
 
-func (c dwctxt) AddDWARFAddrSectionOffset(s dwarf.Sym, t interface{}, ofs int64) {
+func (c dwctxt) AddDWARFAddrSectionOffset(s dwarf.Sym, t any, ofs int64) {
        size := 4
        if isDwarf64(c.linkctxt) {
                size = 8
@@ -148,14 +148,14 @@ func (c dwctxt) AddDWARFAddrSectionOffset(s dwarf.Sym, t interface{}, ofs int64)
        dsu.AddSymRef(c.arch, tds, ofs, objabi.R_DWARFSECREF, size)
 }
 
-func (c dwctxt) AddIndirectTextRef(s dwarf.Sym, t interface{}) {
+func (c dwctxt) AddIndirectTextRef(s dwarf.Sym, t any) {
        ds := loader.Sym(s.(dwSym))
        dsu := c.ldr.MakeSymbolUpdater(ds)
        tds := loader.Sym(t.(dwSym))
        dsu.AddSymRef(c.arch, tds, 0, objabi.R_DWTXTADDR_U4, 4)
 }
 
-func (c dwctxt) Logf(format string, args ...interface{}) {
+func (c dwctxt) Logf(format string, args ...any) {
        c.linkctxt.Logf(format, args...)
 }
 
@@ -239,7 +239,7 @@ var dwtypes dwarf.DWDie
 // up all attrs in a single large table, then store indices into the
 // table in the DIE. This would allow us to common up storage for
 // attributes that are shared by many DIEs (ex: byte size of N).
-func newattr(die *dwarf.DWDie, attr uint16, cls int, value int64, data interface{}) {
+func newattr(die *dwarf.DWDie, attr uint16, cls int, value int64, data any) {
        a := new(dwarf.DWAttr)
        a.Link = die.Attr
        die.Attr = a
index df1fc7feabac302a8440833c878ee0c5bdac5fff..2276d39d8885dd313eb0e9e784587d7b9f191078 100644 (file)
@@ -126,7 +126,7 @@ type cgodata struct {
        directives [][]string
 }
 
-func (ctxt *Link) Logf(format string, args ...interface{}) {
+func (ctxt *Link) Logf(format string, args ...any) {
        fmt.Fprintf(ctxt.Bso, format, args...)
        ctxt.Bso.Flush()
 }
index d60755f147d51174fb6d5660fbab9280c88f85e1..2b303cbdae138e13926e1dff03f8bff398deee76 100644 (file)
@@ -392,7 +392,7 @@ func machoUpdateDwarfHeader(r *imacho.LoadCmdUpdater, compressedSects []*macho.S
        return machoUpdateSections(*r, &seg, uint64(dwarfstart)-realdwarf.Offset, compressedSects)
 }
 
-func machoUpdateLoadCommand(r imacho.LoadCmdUpdater, linkseg *macho.Segment, linkoffset uint64, cmd interface{}, fields ...string) error {
+func machoUpdateLoadCommand(r imacho.LoadCmdUpdater, linkseg *macho.Segment, linkoffset uint64, cmd any, fields ...string) error {
        if err := r.ReadAt(0, cmd); err != nil {
                return err
        }
index 556c77d73262586830f25b29c45405e72b80157e..f3787ff50b4293334054f7c8dd7bfd8afd357392 100644 (file)
@@ -32,7 +32,7 @@ func Exit(code int) {
 }
 
 // Exitf logs an error message then calls Exit(2).
-func Exitf(format string, a ...interface{}) {
+func Exitf(format string, a ...any) {
        fmt.Fprintf(os.Stderr, os.Args[0]+": "+format+"\n", a...)
        nerrors++
        if *flagH {
@@ -60,7 +60,7 @@ func afterErrorAction() {
 //
 // Logging an error means that on exit cmd/link will delete any
 // output file and return a non-zero error code.
-func Errorf(format string, args ...interface{}) {
+func Errorf(format string, args ...any) {
        format += "\n"
        fmt.Fprintf(os.Stderr, format, args...)
        afterErrorAction()
@@ -72,7 +72,7 @@ func Errorf(format string, args ...interface{}) {
 //
 // Logging an error means that on exit cmd/link will delete any
 // output file and return a non-zero error code.
-func (ctxt *Link) Errorf(s loader.Sym, format string, args ...interface{}) {
+func (ctxt *Link) Errorf(s loader.Sym, format string, args ...any) {
        if ctxt.loader != nil {
                ctxt.loader.Errorf(s, format, args...)
                return
index fc98fcba2bccebe0fc8df61642f0f9d474b70ea7..4500a7cb0c95b3f879c5aef941f8aff336871679 100644 (file)
@@ -167,8 +167,7 @@ const (
 )
 
 // Type representing all XCOFF symbols.
-type xcoffSym interface {
-}
+type xcoffSym any
 
 // Symbol Table Entry
 type XcoffSymEnt64 struct {
index 9434704be4dc994354731af7da52fba2808db037..1c83f03a5db16fa43f2be51e27261c031e089f86 100644 (file)
@@ -242,7 +242,7 @@ func parseArmAttributes(e binary.ByteOrder, data []byte) (found bool, ehdrFlags
 // object, and the returned ehdrFlags contains what this Load function computes.
 // TODO: find a better place for this logic.
 func Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, f *bio.Reader, pkg string, length int64, pn string, initEhdrFlags uint32) (textp []loader.Sym, ehdrFlags uint32, err error) {
-       errorf := func(str string, args ...interface{}) ([]loader.Sym, uint32, error) {
+       errorf := func(str string, args ...any) ([]loader.Sym, uint32, error) {
                return nil, 0, fmt.Errorf("loadelf: %s: %v", pn, fmt.Sprintf(str, args...))
        }
 
index a612a1ac81587562f8a5d70660ed953cf58e9898..2d386c0c65e351d451d4c4fbba1dda93a09e92a0 100644 (file)
@@ -2821,7 +2821,7 @@ type ErrorReporter struct {
 //
 // Logging an error means that on exit cmd/link will delete any
 // output file and return a non-zero error code.
-func (reporter *ErrorReporter) Errorf(s Sym, format string, args ...interface{}) {
+func (reporter *ErrorReporter) Errorf(s Sym, format string, args ...any) {
        if s != 0 && reporter.ldr.SymName(s) != "" {
                // Note: Replace is needed here because symbol names might have % in them,
                // due to the use of LinkString for names of instantiating types.
@@ -2840,7 +2840,7 @@ func (l *Loader) GetErrorReporter() *ErrorReporter {
 }
 
 // Errorf method logs an error message. See ErrorReporter.Errorf for details.
-func (l *Loader) Errorf(s Sym, format string, args ...interface{}) {
+func (l *Loader) Errorf(s Sym, format string, args ...any) {
        l.errorReporter.Errorf(s, format, args...)
 }
 
index dcb0fd92c1f357109ded690a091eaa76d0f252d7..ecd01509433709d4196c930ea7298b9e2c05c9f8 100644 (file)
@@ -424,7 +424,7 @@ func macholoadsym(m *ldMachoObj, symtab *ldMachoSymtab) int {
 // Load the Mach-O file pn from f.
 // Symbols are written into syms, and a slice of the text symbols is returned.
 func Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, f *bio.Reader, pkg string, length int64, pn string) (textp []loader.Sym, err error) {
-       errorf := func(str string, args ...interface{}) ([]loader.Sym, error) {
+       errorf := func(str string, args ...any) ([]loader.Sym, error) {
                return nil, fmt.Errorf("loadmacho: %v: %v", pn, fmt.Sprintf(str, args...))
        }
 
index fd116d542071333c3613b489155ea247687564ec..8c0949ec70a76b8fa107febe34b4f00682d22fd4 100644 (file)
@@ -42,7 +42,7 @@ func (f *xcoffBiobuf) ReadAt(p []byte, off int64) (int, error) {
 // loads the Xcoff file pn from f.
 // Symbols are written into loader, and a slice of the text symbols is returned.
 func Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, input *bio.Reader, pkg string, length int64, pn string) (textp []loader.Sym, err error) {
-       errorf := func(str string, args ...interface{}) ([]loader.Sym, error) {
+       errorf := func(str string, args ...any) ([]loader.Sym, error) {
                return nil, fmt.Errorf("loadxcoff: %v: %v", pn, fmt.Sprintf(str, args...))
        }
 
index c889e71ad64b8baf7cb6a581a7a98ac3f79ca1cd..d397b8457076c0c82ffcd30049386405bad2efcf 100644 (file)
@@ -52,7 +52,7 @@ type Section struct {
        Vaddr   uint64
        Length  uint64
        Seg     *Segment
-       Elfsect interface{} // an *ld.ElfShdr
+       Elfsect any // an *ld.ElfShdr
        Reloff  uint64
        Rellen  uint64
        // Relcount is the number of *host* relocations applied to this section
index 9105eb30aa075335232fe2e04393a102c8cac65a..f7d48a0fb802f3488da5dab6b8d7bdff771505f6 100644 (file)
@@ -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")
index 1893a7fc0c41025d11b210bad22086a171608b26..47831dbfb248d1f5176cb34670caa3b5f23f2db6 100644 (file)
@@ -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)
                },
index d3fa61dc97d39873e0979e411cf99992793db49b..291a19f44cdaee37bff25b5e84a23918b5e4027b 100644 (file)
@@ -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:
index 3ee43fbc94b45f637ba72ee296dd1f048c80817c..3810685cbd110c73fb9b32ab52ba58f575c56b27 100644 (file)
@@ -1274,7 +1274,7 @@ func TestDecoderOverflow(t *testing.T) {
                0x12, 0xff, 0xff, 0x2, 0x2, 0x20, 0x0, 0xf8, 0x7f, 0xff, 0xff, 0xff,
                0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20,
        }))
-       var r interface{}
+       var r any
        err := dec.Decode(r)
        if err == nil {
                t.Fatalf("expected an error")
index be1ec5d5f7e10095146a4d317fbd153acf5525b3..fabcbe602a665478c40f52d9da1f3ef563610f07 100644 (file)
@@ -57,7 +57,7 @@ func (check *Checker) newError(code Code) *error_ {
 // Subsequent calls to addf provide additional information in the form of additional lines
 // in the error message (types2) or continuation errors identified by a tab-indented error
 // message (go/types).
-func (err *error_) addf(at positioner, format string, args ...interface{}) {
+func (err *error_) addf(at positioner, format string, args ...any) {
        err.desc = append(err.desc, errorDesc{at, err.check.sprintf(format, args...)})
 }
 
index 65995d9bffe690f445b6c718c1b437d8b380c2d0..8b3f764f1923c9a8a34935d3a550fa937373a3db 100644 (file)
@@ -1198,7 +1198,7 @@ Error:
 // represented as an integer (such as 1.0) it is returned as an integer value.
 // This ensures that constants of different kind but equal value (such as
 // 1.0 + 0i, 1.0, 1) result in the same value.
-func keyVal(x constant.Value) interface{} {
+func keyVal(x constant.Value) any {
        switch x.Kind() {
        case constant.Complex:
                f := constant.ToFloat(x)
index afd7ee28bd2074c5622ac3f3184298dce06129c0..8e807b36bfc5f4e00ae79beda8f8a280445dcc84 100644 (file)
@@ -71,7 +71,7 @@ type gen struct {
        bytes.Buffer
 }
 
-func (g *gen) p(format string, args ...interface{}) {
+func (g *gen) p(format string, args ...any) {
        fmt.Fprintf(&g.Buffer, format, args...)
 }
 
index 3b52e6e1e67350868fee42928873b72506177dcc..bf072c09d9f1d24be95e1d1db6ed62d0de11d925 100644 (file)
@@ -144,7 +144,7 @@ func (u *unifier) unify(x, y Type, mode unifyMode) bool {
        return u.nify(x, y, mode, nil)
 }
 
-func (u *unifier) tracef(format string, args ...interface{}) {
+func (u *unifier) tracef(format string, args ...any) {
        fmt.Println(strings.Repeat(".  ", u.depth) + sprintf(nil, nil, true, format, args...))
 }
 
index 81331103980fc7f109f063ff20ce94cb53ece231..5ba12c406a7896349e1086f8f0faf175f45f7ece 100644 (file)
@@ -58,7 +58,7 @@ func (check *Checker) allowVersion(want goVersion) bool {
 
 // verifyVersionf is like allowVersion but also accepts a format string and arguments
 // which are used to report a version error if allowVersion returns false.
-func (check *Checker) verifyVersionf(at positioner, v goVersion, format string, args ...interface{}) bool {
+func (check *Checker) verifyVersionf(at positioner, v goVersion, format string, args ...any) bool {
        if !check.allowVersion(v) {
                check.versionErrorf(at, v, format, args...)
                return false
index e038d3658486d2e7827aa09f8e9c2f96dc5993ef..54b0735f6b199cb3dca1f52fcbe2e4a832d5862c 100644 (file)
@@ -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
index e6180fb241ef6f500efabe5226df56b9a67f018e..15b56f823aee7fd342dd3dbf012a35837b6bfb85 100644 (file)
@@ -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")
index 279e1beda1be729d3a6ef27dbf9e32587ba246b5..0cce6a7422b34603709c46106e33555206295cf9 100644 (file)
@@ -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
                                })
index 8bfb632544721a49056bc2a1f58a23a6d503ed6f..71b0c7ce31a843adbbfc06e1191524eb7a1e28ae 100644 (file)
@@ -179,7 +179,7 @@ func checkAliasingTwoArgs(t *testing.T, f func(v, x, y *big.Int) *big.Int, v, x,
 }
 
 func TestAliasing(t *testing.T) {
-       for name, f := range map[string]interface{}{
+       for name, f := range map[string]any{
                "Abs": func(v, x bigInt) bool {
                        return checkAliasingOneArg(t, (*big.Int).Abs, v.Int, x.Int)
                },
index 1fa850a27562ce245489fc064583ac8ddf4efc41..8509f00a5eeef6dcd000b9fc0f14c5d23e3e57ee 100644 (file)
@@ -8096,11 +8096,11 @@ func TestValue_Len(t *testing.T) {
 func TestValue_Comparable(t *testing.T) {
        var a int
        var s []int
-       var i interface{} = a
-       var iNil interface{}
-       var iSlice interface{} = s
-       var iArrayFalse interface{} = [2]interface{}{1, map[int]int{}}
-       var iArrayTrue interface{} = [2]interface{}{1, struct{ I interface{} }{1}}
+       var i any = a
+       var iNil any
+       var iSlice any = s
+       var iArrayFalse any = [2]any{1, map[int]int{}}
+       var iArrayTrue any = [2]any{1, struct{ I any }{1}}
        var testcases = []struct {
                value      Value
                comparable bool
@@ -8237,22 +8237,22 @@ func TestValue_Comparable(t *testing.T) {
                        false,
                },
                {
-                       ValueOf([2]struct{ I interface{} }{{1}, {1}}),
+                       ValueOf([2]struct{ I any }{{1}, {1}}),
                        true,
                        false,
                },
                {
-                       ValueOf([2]struct{ I interface{} }{{[]int{}}, {1}}),
+                       ValueOf([2]struct{ I any }{{[]int{}}, {1}}),
                        false,
                        false,
                },
                {
-                       ValueOf([2]interface{}{1, struct{ I int }{1}}),
+                       ValueOf([2]any{1, struct{ I int }{1}}),
                        true,
                        false,
                },
                {
-                       ValueOf([2]interface{}{[1]interface{}{map[int]int{}}, struct{ I int }{1}}),
+                       ValueOf([2]any{[1]any{map[int]int{}}, struct{ I int }{1}}),
                        false,
                        false,
                },
@@ -8286,10 +8286,10 @@ type ValueEqualTest struct {
        vDeref, uDeref bool
 }
 
-var equalI interface{} = 1
-var equalSlice interface{} = []int{1}
-var nilInterface interface{}
-var mapInterface interface{} = map[int]int{}
+var equalI any = 1
+var equalSlice any = []int{1}
+var nilInterface any
+var mapInterface any = map[int]int{}
 
 var valueEqualTests = []ValueEqualTest{
        {
@@ -8468,8 +8468,8 @@ func TestValue_EqualNonComparable(t *testing.T) {
                // Value of array is non-comparable because of non-comparable elements.
                ValueOf([0]map[int]int{}),
                ValueOf([0]func(){}),
-               ValueOf(([1]struct{ I interface{} }{{[]int{}}})),
-               ValueOf(([1]interface{}{[1]interface{}{map[int]int{}}})),
+               ValueOf(([1]struct{ I any }{{[]int{}}})),
+               ValueOf(([1]any{[1]any{map[int]int{}}})),
        }
        for _, value := range values {
                // Panic when reflect.Value.Equal using two valid non-comparable values.
index fc76a4fb9858e5f78b2bee7a7f97fe70b5952f91..00344c62317209090af20237e1110e6ffe5d261e 100644 (file)
@@ -12,7 +12,7 @@ import (
 func TestTypeFor(t *testing.T) {
        type (
                mystring string
-               myiface  interface{}
+               myiface  any
        )
 
        testcases := []struct {
index b67424301b42fafa3518747f66a41fa561436714..92cec75465ce4cc2c93ccfaf699c092e05982026 100644 (file)
@@ -471,7 +471,7 @@ func BenchmarkReadMetricsLatency(b *testing.B) {
        b.ReportMetric(float64(latencies[len(latencies)*99/100]), "p99-ns")
 }
 
-var readMetricsSink [1024]interface{}
+var readMetricsSink [1024]any
 
 func TestReadMetricsCumulative(t *testing.T) {
        // Set up the set of metrics marked cumulative.
index b816833e52285f20a3e62f7c3b9ba3f849e16a9f..adbd1932a43210b7f8dae1d52aa8b3afd29f5815 100644 (file)
@@ -1627,7 +1627,7 @@ func TestGoroutineProfileConcurrency(t *testing.T) {
                obj := new(T)
                ch1, ch2 := make(chan int), make(chan int)
                defer close(ch2)
-               runtime.SetFinalizer(obj, func(_ interface{}) {
+               runtime.SetFinalizer(obj, func(_ any) {
                        close(ch1)
                        <-ch2
                })
@@ -1829,7 +1829,7 @@ func TestGoroutineProfileIssue74090(t *testing.T) {
                var objs []*T
                for range 10000 {
                        obj := new(T)
-                       runtime.SetFinalizer(obj, func(_ interface{}) {})
+                       runtime.SetFinalizer(obj, func(_ any) {})
                        objs = append(objs, obj)
                }
                objs = nil