From a83befa0d111a0ba6fac52d763e93c76a2ef94d4 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 19 Dec 2025 12:52:30 +0100 Subject: all: use any instead of interface{} Any is the preferred over interface{} now in Go. --- prog/decodeexec.go | 2 +- prog/encoding.go | 8 ++++---- prog/mutation_test.go | 2 +- prog/prio.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'prog') diff --git a/prog/decodeexec.go b/prog/decodeexec.go index e6921c314..4e7bc8718 100644 --- a/prog/decodeexec.go +++ b/prog/decodeexec.go @@ -35,7 +35,7 @@ type ExecCopyout struct { Size uint64 } -type ExecArg interface{} // one of ExecArg* +type ExecArg any // one of ExecArg* type ExecArgConst struct { Size uint64 diff --git a/prog/encoding.go b/prog/encoding.go index 3bae29316..c468bd79e 100644 --- a/prog/encoding.go +++ b/prog/encoding.go @@ -74,7 +74,7 @@ func (ctx *serializer) print(text string) { ctx.printf("%v", text) } -func (ctx *serializer) printf(text string, args ...interface{}) { +func (ctx *serializer) printf(text string, args ...any) { fmt.Fprintf(ctx.buf, text, args...) } @@ -820,7 +820,7 @@ func (p *parser) parseArgUnion(typ Type, dir Dir) (Arg, error) { } // Eats excessive call arguments and struct fields to recover after description changes. -func (p *parser) eatExcessive(stopAtComma bool, what string, args ...interface{}) { +func (p *parser) eatExcessive(stopAtComma bool, what string, args ...any) { p.strictFailf(what, args...) paren, brack, brace := 0, 0, 0 for !p.EOF() && p.e == nil { @@ -1286,14 +1286,14 @@ func (p *parser) Ident() string { return s } -func (p *parser) failf(msg string, args ...interface{}) { +func (p *parser) failf(msg string, args ...any) { if p.e == nil { p.e = fmt.Errorf("%v\nline #%v:%v: %v", fmt.Sprintf(msg, args...), p.l, p.i, highlightError(p.s, p.i)) } } -func (p *parser) strictFailf(msg string, args ...interface{}) { +func (p *parser) strictFailf(msg string, args ...any) { if p.strict { p.failf(msg, args...) } diff --git a/prog/mutation_test.go b/prog/mutation_test.go index d9734b482..9b90fc837 100644 --- a/prog/mutation_test.go +++ b/prog/mutation_test.go @@ -502,4 +502,4 @@ func BenchmarkStoreLoadInt(b *testing.B) { } } -var sink interface{} +var sink any diff --git a/prog/prio.go b/prog/prio.go index b64a8a9e2..9cbc5552a 100644 --- a/prog/prio.go +++ b/prog/prio.go @@ -192,7 +192,7 @@ func noteUsage(uses map[string]map[int]weights, c *Syscall, weight int32, dir Di noteUsagef(uses, c, weight, dir, "%v", str) } -func noteUsagef(uses map[string]map[int]weights, c *Syscall, weight int32, dir Dir, str string, args ...interface{}) { +func noteUsagef(uses map[string]map[int]weights, c *Syscall, weight int32, dir Dir, str string, args ...any) { id := fmt.Sprintf(str, args...) if uses[id] == nil { uses[id] = make(map[int]weights) -- cgit mrf-deployment