aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/syntax
diff options
context:
space:
mode:
authorAlan Donovan <adonovan@google.com>2025-11-11 14:48:22 -0500
committerGopher Robot <gobot@golang.org>2025-11-11 19:59:40 -0800
commit4bfc3a9d14c0b3bfcfe4ce987e47cda6720785a2 (patch)
tree0cbf1ec55d3a61af8bf45ac4a00af7e7bcc426db /src/cmd/compile/internal/syntax
parent2263d4aabdde8a4a466009ecc356501f87c7efb7 (diff)
downloadgo-4bfc3a9d14c0b3bfcfe4ce987e47cda6720785a2.tar.xz
std,cmd: go fix -any std cmd
This change mechanically replaces all occurrences of interface{} by 'any' (where deemed safe by the 'any' modernizer) throughout std and cmd, minus their vendor trees. Since this fix is relatively numerous, it gets its own CL. Also, 'go generate go/types'. Change-Id: I14a6b52856c3291c1d27935409bca8d5fd4242a2 Reviewed-on: https://go-review.googlesource.com/c/go/+/719702 Commit-Queue: Alan Donovan <adonovan@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'src/cmd/compile/internal/syntax')
-rw-r--r--src/cmd/compile/internal/syntax/branches.go2
-rw-r--r--src/cmd/compile/internal/syntax/dumper.go2
-rw-r--r--src/cmd/compile/internal/syntax/printer.go4
-rw-r--r--src/cmd/compile/internal/syntax/scanner.go4
-rw-r--r--src/cmd/compile/internal/syntax/syntax.go2
5 files changed, 7 insertions, 7 deletions
diff --git a/src/cmd/compile/internal/syntax/branches.go b/src/cmd/compile/internal/syntax/branches.go
index 8b360176e8..3a2479bb8a 100644
--- a/src/cmd/compile/internal/syntax/branches.go
+++ b/src/cmd/compile/internal/syntax/branches.go
@@ -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...)})
}
diff --git a/src/cmd/compile/internal/syntax/dumper.go b/src/cmd/compile/internal/syntax/dumper.go
index d5247886da..9a021a4582 100644
--- a/src/cmd/compile/internal/syntax/dumper.go
+++ b/src/cmd/compile/internal/syntax/dumper.go
@@ -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})
}
diff --git a/src/cmd/compile/internal/syntax/printer.go b/src/cmd/compile/internal/syntax/printer.go
index d86d77e73f..86d93e8932 100644
--- a/src/cmd/compile/internal/syntax/printer.go
+++ b/src/cmd/compile/internal/syntax/printer.go
@@ -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
}
diff --git a/src/cmd/compile/internal/syntax/scanner.go b/src/cmd/compile/internal/syntax/scanner.go
index 807d838386..700908f6bd 100644
--- a/src/cmd/compile/internal/syntax/scanner.go
+++ b/src/cmd/compile/internal/syntax/scanner.go
@@ -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...))
}
diff --git a/src/cmd/compile/internal/syntax/syntax.go b/src/cmd/compile/internal/syntax/syntax.go
index 83b102da9f..dd8f2b8200 100644
--- a/src/cmd/compile/internal/syntax/syntax.go
+++ b/src/cmd/compile/internal/syntax/syntax.go
@@ -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,