std,cmd: go fix -any std cmd

This change mechanically replaces all occurrences of interface{}
by 'any' (where deemed safe by the 'any' modernizer) throughout
std and cmd, minus their vendor trees.

Since this fix is relatively numerous, it gets its own CL.

Also, 'go generate go/types'.

Change-Id: I14a6b52856c3291c1d27935409bca8d5fd4242a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/719702
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Alan Donovan <adonovan@google.com>
This commit is contained in:
Alan Donovan 2025-11-11 14:48:22 -05:00 committed by Gopher Robot
parent 2263d4aabd
commit 4bfc3a9d14
99 changed files with 282 additions and 284 deletions

View 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()
}