aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2025-12-19 12:52:30 +0100
committerAleksandr Nogikh <nogikh@google.com>2025-12-22 02:13:00 +0000
commita83befa0d111a0ba6fac52d763e93c76a2ef94d4 (patch)
tree7d3c28b24229429936a631e8ceb24135856b257d /tools
parent8fb7048c5117ccb592deb5e8e4a62027e6d399cf (diff)
all: use any instead of interface{}
Any is the preferred over interface{} now in Go.
Diffstat (limited to 'tools')
-rw-r--r--tools/syz-benchcmp/benchcmp.go2
-rw-r--r--tools/syz-check/check.go4
-rw-r--r--tools/syz-kconf/parser.go2
-rw-r--r--tools/syz-linter/linter.go4
-rw-r--r--tools/syz-testbed/html.go2
-rw-r--r--tools/syz-testbed/instance.go2
-rw-r--r--tools/syz-testbed/stats.go2
-rw-r--r--tools/syz-testbed/table.go2
-rw-r--r--tools/syz-testbed/testbed.go4
-rw-r--r--tools/syz-upgrade/upgrade.go2
10 files changed, 13 insertions, 13 deletions
diff --git a/tools/syz-benchcmp/benchcmp.go b/tools/syz-benchcmp/benchcmp.go
index 81bd0b900..0f1c2b61d 100644
--- a/tools/syz-benchcmp/benchcmp.go
+++ b/tools/syz-benchcmp/benchcmp.go
@@ -233,7 +233,7 @@ func display(graphs []*Graph) {
tool.Failf("failed to create file: %v", err)
}
}
- vars := map[string]interface{}{
+ vars := map[string]any{
"Graphs": graphs,
"HAxisTitle": getAxisTitle(),
}
diff --git a/tools/syz-check/check.go b/tools/syz-check/check.go
index 8021e8720..bc57ea462 100644
--- a/tools/syz-check/check.go
+++ b/tools/syz-check/check.go
@@ -230,7 +230,7 @@ func checkImpl(structs map[string]*dwarf.StructType, structTypes []prog.Type,
func checkStruct(typ prog.Type, astStruct *ast.Struct, str *dwarf.StructType) ([]Warn, error) {
var warnings []Warn
- warn := func(pos ast.Pos, typ, msg string, args ...interface{}) {
+ warn := func(pos ast.Pos, typ, msg string, args ...any) {
warnings = append(warnings, Warn{pos: pos, typ: typ, msg: fmt.Sprintf(msg, args...)})
}
name := typ.TemplateName()
@@ -558,7 +558,7 @@ func isNlattr(typ prog.Type) bool {
func checkNetlinkPolicy(structMap map[string]prog.Type, typ prog.Type, fields []prog.Field,
astStruct *ast.Struct, policy []nlaPolicy) ([]Warn, map[int]bool, error) {
var warnings []Warn
- warn := func(pos ast.Pos, typ, msg string, args ...interface{}) {
+ warn := func(pos ast.Pos, typ, msg string, args ...any) {
warnings = append(warnings, Warn{pos: pos, typ: typ, msg: fmt.Sprintf(msg, args...)})
}
checked := make(map[int]bool)
diff --git a/tools/syz-kconf/parser.go b/tools/syz-kconf/parser.go
index a37e5f2ed..eb21c1c1f 100644
--- a/tools/syz-kconf/parser.go
+++ b/tools/syz-kconf/parser.go
@@ -331,7 +331,7 @@ func parseNode(node yaml.Node) (name, val string, constraints []string, err erro
type Errors []byte
-func (errs *Errors) push(msg string, args ...interface{}) {
+func (errs *Errors) push(msg string, args ...any) {
*errs = append(*errs, fmt.Sprintf(msg+"\n", args...)...)
}
diff --git a/tools/syz-linter/linter.go b/tools/syz-linter/linter.go
index d29e256a3..5b3d2210d 100644
--- a/tools/syz-linter/linter.go
+++ b/tools/syz-linter/linter.go
@@ -54,7 +54,7 @@ var SyzAnalyzer = &analysis.Analyzer{
Run: run,
}
-func run(p *analysis.Pass) (interface{}, error) {
+func run(p *analysis.Pass) (any, error) {
pass := (*Pass)(p)
for _, file := range pass.Files {
stmts := make(map[int]bool)
@@ -91,7 +91,7 @@ func run(p *analysis.Pass) (interface{}, error) {
type Pass analysis.Pass
-func (pass *Pass) report(pos ast.Node, msg string, args ...interface{}) {
+func (pass *Pass) report(pos ast.Node, msg string, args ...any) {
pass.Report(analysis.Diagnostic{
Pos: pos.Pos(),
Message: fmt.Sprintf(msg, args...),
diff --git a/tools/syz-testbed/html.go b/tools/syz-testbed/html.go
index e8e2e9a22..e02ef0170 100644
--- a/tools/syz-testbed/html.go
+++ b/tools/syz-testbed/html.go
@@ -291,7 +291,7 @@ func (ctx *TestbedContext) httpMain(w http.ResponseWriter, r *http.Request) {
executeTemplate(w, mainTemplate, "testbed.html", data)
}
-func executeTemplate(w http.ResponseWriter, templ *template.Template, name string, data interface{}) {
+func executeTemplate(w http.ResponseWriter, templ *template.Template, name string, data any) {
buf := new(bytes.Buffer)
if err := templ.ExecuteTemplate(buf, name, data); err != nil {
log.Printf("failed to execute template: %v", err)
diff --git a/tools/syz-testbed/instance.go b/tools/syz-testbed/instance.go
index 5ec278944..476981d7a 100644
--- a/tools/syz-testbed/instance.go
+++ b/tools/syz-testbed/instance.go
@@ -145,7 +145,7 @@ func SetupSyzkallerInstance(mgrName, folder string, checkout *Checkout) (*Syzkal
}
log.Printf("[%s] Generating syz-manager config", mgrName)
cfgFile := filepath.Join(folder, "manager.cfg")
- managerCfg, err := config.PatchJSON(checkout.ManagerConfig, map[string]interface{}{
+ managerCfg, err := config.PatchJSON(checkout.ManagerConfig, map[string]any{
"name": mgrName,
"workdir": workdir,
"syzkaller": checkout.Path,
diff --git a/tools/syz-testbed/stats.go b/tools/syz-testbed/stats.go
index 4ac02b230..9205ed965 100644
--- a/tools/syz-testbed/stats.go
+++ b/tools/syz-testbed/stats.go
@@ -19,7 +19,7 @@ type BugInfo struct {
Logs []string
}
-type RunResult interface{}
+type RunResult any
// The information collected from a syz-manager instance.
type SyzManagerResult struct {
diff --git a/tools/syz-testbed/table.go b/tools/syz-testbed/table.go
index a4bdd98af..ba7ee05d1 100644
--- a/tools/syz-testbed/table.go
+++ b/tools/syz-testbed/table.go
@@ -13,7 +13,7 @@ import (
"github.com/google/syzkaller/pkg/stat/sample"
)
-type Cell = interface{}
+type Cell = any
// All tables that syz-testbed generates have named columns and rows.
// Table type simplifies generation and processing of such tables.
diff --git a/tools/syz-testbed/testbed.go b/tools/syz-testbed/testbed.go
index 357ff65f6..87d3b4527 100644
--- a/tools/syz-testbed/testbed.go
+++ b/tools/syz-testbed/testbed.go
@@ -131,7 +131,7 @@ func (ctx *TestbedContext) MakeMgrConfig(base, patch json.RawMessage) json.RawMe
tool.Failf("failed to apply a patch to the base manager config: %s", err)
}
// We don't care much about the specific ports of syz-managers.
- mgrCfg, err = config.PatchJSON(mgrCfg, map[string]interface{}{"HTTP": ":0"})
+ mgrCfg, err = config.PatchJSON(mgrCfg, map[string]any{"HTTP": ":0"})
if err != nil {
tool.Failf("failed to assign empty HTTP value: %s", err)
}
@@ -266,7 +266,7 @@ func (ctx *TestbedContext) Loop(stop chan struct{}) {
}
func (d *DurationConfig) UnmarshalJSON(data []byte) error {
- var v interface{}
+ var v any
if err := json.Unmarshal(data, &v); err != nil {
return err
}
diff --git a/tools/syz-upgrade/upgrade.go b/tools/syz-upgrade/upgrade.go
index 93d2dc881..e1ca4454d 100644
--- a/tools/syz-upgrade/upgrade.go
+++ b/tools/syz-upgrade/upgrade.go
@@ -59,7 +59,7 @@ func main() {
}
}
-func fatalf(msg string, args ...interface{}) {
+func fatalf(msg string, args ...any) {
fmt.Fprintf(os.Stderr, msg+"\n", args...)
os.Exit(1)
}