aboutsummaryrefslogtreecommitdiffstats
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
parent8fb7048c5117ccb592deb5e8e4a62027e6d399cf (diff)
all: use any instead of interface{}
Any is the preferred over interface{} now in Go.
-rw-r--r--dashboard/app/api.go58
-rw-r--r--dashboard/app/coverage.go2
-rw-r--r--dashboard/app/entities_spanner.go2
-rw-r--r--dashboard/app/handler.go2
-rw-r--r--dashboard/app/jobs.go2
-rw-r--r--dashboard/app/label.go4
-rw-r--r--dashboard/app/main.go4
-rw-r--r--dashboard/app/public_json_api.go4
-rw-r--r--dashboard/app/reporting_external.go10
-rw-r--r--dashboard/app/subsystem.go2
-rw-r--r--dashboard/app/tree.go6
-rw-r--r--dashboard/app/util_test.go10
-rw-r--r--dashboard/dashapi/dashapi.go8
-rw-r--r--pkg/ast/parser_test.go8
-rw-r--r--pkg/ast/scanner.go2
-rw-r--r--pkg/bisect/bisect.go2
-rw-r--r--pkg/bisect/minimize/slice.go4
-rw-r--r--pkg/compiler/compiler.go4
-rw-r--r--pkg/compiler/const_file.go4
-rw-r--r--pkg/config/config.go6
-rw-r--r--pkg/config/merge.go10
-rw-r--r--pkg/config/merge_test.go16
-rw-r--r--pkg/coveragedb/coveragedb.go8
-rw-r--r--pkg/coveragedb/functions.go2
-rw-r--r--pkg/coveragedb/mocks/Row.go14
-rw-r--r--pkg/coveragedb/spannerclient/spanner_client.go2
-rw-r--r--pkg/debugtracer/debug.go10
-rw-r--r--pkg/fuzzer/fuzzer.go4
-rw-r--r--pkg/fuzzer/fuzzer_test.go2
-rw-r--r--pkg/html/html.go2
-rw-r--r--pkg/ifuzz/x86/gen/gen.go2
-rw-r--r--pkg/image/compression_optimized.go2
-rw-r--r--pkg/instance/execprog.go4
-rw-r--r--pkg/instance/instance.go4
-rw-r--r--pkg/kconfig/parser.go2
-rw-r--r--pkg/log/log.go10
-rw-r--r--pkg/manager/diff.go2
-rw-r--r--pkg/manager/http.go2
-rw-r--r--pkg/mgrconfig/mgrconfig_test.go2
-rw-r--r--pkg/repro/repro.go8
-rw-r--r--pkg/rpctype/rpc.go4
-rw-r--r--pkg/runtest/run.go2
-rw-r--r--pkg/serializer/serializer.go6
-rw-r--r--pkg/serializer/serializer_test.go4
-rw-r--r--pkg/signal/signal.go6
-rw-r--r--pkg/subsystem/linux/maintainers.go2
-rw-r--r--pkg/tool/tool.go2
-rw-r--r--prog/decodeexec.go2
-rw-r--r--prog/encoding.go8
-rw-r--r--prog/mutation_test.go2
-rw-r--r--prog/prio.go2
-rw-r--r--sys/syz-extract/extract.go4
-rw-r--r--syz-ci/jobs.go6
-rw-r--r--syz-ci/manager.go4
-rw-r--r--syz-ci/manager_test.go2
-rw-r--r--syz-ci/managercmd.go2
-rw-r--r--syz-cluster/pkg/app/logging.go4
-rw-r--r--syz-cluster/pkg/controller/api.go10
-rw-r--r--syz-cluster/pkg/db/base_finding_repo.go2
-rw-r--r--syz-cluster/pkg/db/build_repo.go2
-rw-r--r--syz-cluster/pkg/db/finding_repo.go6
-rw-r--r--syz-cluster/pkg/db/report_reply_repo.go6
-rw-r--r--syz-cluster/pkg/db/report_repo.go2
-rw-r--r--syz-cluster/pkg/db/series_repo.go14
-rw-r--r--syz-cluster/pkg/db/session_repo.go10
-rw-r--r--syz-cluster/pkg/db/session_test_repo.go8
-rw-r--r--syz-cluster/pkg/db/spanner.go4
-rw-r--r--syz-cluster/pkg/reporter/api.go6
-rw-r--r--syz-manager/manager.go2
-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
-rw-r--r--vm/proxyapp/proxyappclient.go6
-rw-r--r--vm/qemu/qmp.go10
81 files changed, 214 insertions, 214 deletions
diff --git a/dashboard/app/api.go b/dashboard/app/api.go
index 1e7d655c4..c7539c5f5 100644
--- a/dashboard/app/api.go
+++ b/dashboard/app/api.go
@@ -77,8 +77,8 @@ var apiHandlers = map[string]APIHandler{
"log_to_repro": nsHandler(apiLogToReproduce),
}
-type JSONHandler func(c context.Context, r *http.Request) (interface{}, error)
-type APIHandler func(c context.Context, payload io.Reader) (interface{}, error)
+type JSONHandler func(c context.Context, r *http.Request) (any, error)
+type APIHandler func(c context.Context, payload io.Reader) (any, error)
const (
maxReproPerBug = 10
@@ -126,7 +126,7 @@ func handleJSON(fn JSONHandler) http.Handler {
})
}
-func handleAPI(c context.Context, r *http.Request) (interface{}, error) {
+func handleAPI(c context.Context, r *http.Request) (any, error) {
client := r.PostFormValue("client")
method := r.PostFormValue("method")
log.Infof(c, "api %q from %q", method, client)
@@ -178,7 +178,7 @@ func contextNamespace(c context.Context) string {
// gcsPayloadHandler json.Decode the gcsURL from payload and stream pointed content.
// This function streams ungzipped content in order to be aligned with other wrappers/handlers.
func gcsPayloadHandler(handler APIHandler) APIHandler {
- return func(c context.Context, payload io.Reader) (interface{}, error) {
+ return func(c context.Context, payload io.Reader) (any, error) {
var gcsURL string
if err := json.NewDecoder(payload).Decode(&gcsURL); err != nil {
return nil, fmt.Errorf("json.NewDecoder(payload).Decode(&gcsURL): %w", err)
@@ -216,7 +216,7 @@ func nsHandler[Req any](handler func(context.Context, string, *Req) (any, error)
}
func typedHandler[Req any](handler func(context.Context, *Req) (any, error)) APIHandler {
- return func(ctx context.Context, payload io.Reader) (interface{}, error) {
+ return func(ctx context.Context, payload io.Reader) (any, error) {
req := new(Req)
if payload != nil {
if err := json.NewDecoder(payload).Decode(req); err != nil {
@@ -227,12 +227,12 @@ func typedHandler[Req any](handler func(context.Context, *Req) (any, error)) API
}
}
-func apiLogError(c context.Context, req *dashapi.LogEntry) (interface{}, error) {
+func apiLogError(c context.Context, req *dashapi.LogEntry) (any, error) {
log.Errorf(c, "%v: %v", req.Name, req.Text)
return nil, nil
}
-func apiBuilderPoll(c context.Context, ns string, req *dashapi.BuilderPollReq) (interface{}, error) {
+func apiBuilderPoll(c context.Context, ns string, req *dashapi.BuilderPollReq) (any, error) {
bugs, _, err := loadAllBugs(c, func(query *db.Query) *db.Query {
return query.Filter("Namespace=", ns).
Filter("Status<", BugStatusFixed)
@@ -277,7 +277,7 @@ func reportEmail(c context.Context, ns string) string {
return ""
}
-func apiCommitPoll(c context.Context, ns string, req *any) (interface{}, error) {
+func apiCommitPoll(c context.Context, ns string, req *any) (any, error) {
resp := &dashapi.CommitPollResp{
ReportEmail: reportEmail(c, ns),
}
@@ -343,7 +343,7 @@ func pollBackportCommits(c context.Context, ns string, count int) ([]string, err
return backportTitles, nil
}
-func apiUploadCommits(c context.Context, ns string, req *dashapi.CommitPollResultReq) (interface{}, error) {
+func apiUploadCommits(c context.Context, ns string, req *dashapi.CommitPollResultReq) (any, error) {
// This adds fixing commits to bugs.
err := addCommitsToBugs(c, ns, "", nil, req.Commits)
if err != nil {
@@ -444,7 +444,7 @@ func addCommitInfoToBugImpl(c context.Context, bug *Bug, com dashapi.Commit) (bo
return changed, nil
}
-func apiJobPoll(c context.Context, req *dashapi.JobPollReq) (interface{}, error) {
+func apiJobPoll(c context.Context, req *dashapi.JobPollReq) (any, error) {
if stop, err := emergentlyStopped(c); err != nil || stop {
// The bot's operation was aborted. Don't accept new crash reports.
return &dashapi.JobPollResp{}, err
@@ -455,17 +455,17 @@ func apiJobPoll(c context.Context, req *dashapi.JobPollReq) (interface{}, error)
return pollPendingJobs(c, req.Managers)
}
-func apiJobDone(c context.Context, req *dashapi.JobDoneReq) (interface{}, error) {
+func apiJobDone(c context.Context, req *dashapi.JobDoneReq) (any, error) {
err := doneJob(c, req)
return nil, err
}
-func apiJobReset(c context.Context, req *dashapi.JobResetReq) (interface{}, error) {
+func apiJobReset(c context.Context, req *dashapi.JobResetReq) (any, error) {
err := resetJobs(c, req)
return nil, err
}
-func apiUploadBuild(c context.Context, ns string, req *dashapi.Build) (interface{}, error) {
+func apiUploadBuild(c context.Context, ns string, req *dashapi.Build) (any, error) {
now := timeNow(c)
_, isNewBuild, err := uploadBuild(c, now, ns, req, BuildNormal)
if err != nil {
@@ -732,7 +732,7 @@ func managerList(c context.Context, ns string) ([]string, error) {
return managers, nil
}
-func apiReportBuildError(c context.Context, ns string, req *dashapi.BuildErrorReq) (interface{}, error) {
+func apiReportBuildError(c context.Context, ns string, req *dashapi.BuildErrorReq) (any, error) {
now := timeNow(c)
build, _, err := uploadBuild(c, now, ns, &req.Build, BuildFailed)
if err != nil {
@@ -762,7 +762,7 @@ const (
suppressedReportTitle = "suppressed report"
)
-func apiReportCrash(c context.Context, ns string, req *dashapi.Crash) (interface{}, error) {
+func apiReportCrash(c context.Context, ns string, req *dashapi.Crash) (any, error) {
if stop, err := emergentlyStopped(c); err != nil || stop {
// The bot's operation was aborted. Don't accept new crash reports.
return &dashapi.ReportCrashResp{}, err
@@ -1067,7 +1067,7 @@ func purgeOldCrashes(c context.Context, bug *Bug, bugKey *db.Key) {
log.Infof(c, "deleted %v crashes for bug %q", deleted, bug.Title)
}
-func apiReportFailedRepro(c context.Context, ns string, req *dashapi.CrashID) (interface{}, error) {
+func apiReportFailedRepro(c context.Context, ns string, req *dashapi.CrashID) (any, error) {
req.Title = canonicalizeCrashTitle(req.Title, req.Corrupted, req.Suppressed)
bug, err := findExistingBugForCrash(c, ns, []string{req.Title})
if err != nil {
@@ -1134,7 +1134,7 @@ func saveReproAttempt(c context.Context, bug *Bug, build *Build, log []byte) err
return nil
}
-func apiNeedRepro(c context.Context, ns string, req *dashapi.CrashID) (interface{}, error) {
+func apiNeedRepro(c context.Context, ns string, req *dashapi.CrashID) (any, error) {
if req.Corrupted {
resp := &dashapi.NeedReproResp{
NeedRepro: false,
@@ -1182,7 +1182,7 @@ func normalizeCrashTitle(title string) string {
return strings.TrimSpace(limitLength(title, maxTextLen))
}
-func apiManagerStats(c context.Context, ns string, req *dashapi.ManagerStatsReq) (interface{}, error) {
+func apiManagerStats(c context.Context, ns string, req *dashapi.ManagerStatsReq) (any, error) {
now := timeNow(c)
err := updateManager(c, ns, req.Name, func(mgr *Manager, stats *ManagerStats) error {
mgr.Link = req.Addr
@@ -1203,7 +1203,7 @@ func apiManagerStats(c context.Context, ns string, req *dashapi.ManagerStatsReq)
return nil, err
}
-func apiUpdateReport(c context.Context, ns string, req *dashapi.UpdateReportReq) (interface{}, error) {
+func apiUpdateReport(c context.Context, ns string, req *dashapi.UpdateReportReq) (any, error) {
bug := new(Bug)
bugKey := db.NewKey(c, "Bug", req.BugID, 0, nil)
if err := db.Get(c, bugKey, bug); err != nil {
@@ -1229,7 +1229,7 @@ func apiUpdateReport(c context.Context, ns string, req *dashapi.UpdateReportReq)
return nil, runInTransaction(c, tx, nil)
}
-func apiBugList(c context.Context, ns string, req *any) (interface{}, error) {
+func apiBugList(c context.Context, ns string, req *any) (any, error) {
keys, err := db.NewQuery("Bug").
Filter("Namespace=", ns).
KeysOnly().
@@ -1244,7 +1244,7 @@ func apiBugList(c context.Context, ns string, req *any) (interface{}, error) {
return resp, nil
}
-func apiLoadBug(c context.Context, ns string, req *dashapi.LoadBugReq) (interface{}, error) {
+func apiLoadBug(c context.Context, ns string, req *dashapi.LoadBugReq) (any, error) {
bug := new(Bug)
bugKey := db.NewKey(c, "Bug", req.ID, 0, nil)
if err := db.Get(c, bugKey, bug); err != nil {
@@ -1256,7 +1256,7 @@ func apiLoadBug(c context.Context, ns string, req *dashapi.LoadBugReq) (interfac
return loadBugReport(c, bug)
}
-func apiLoadFullBug(c context.Context, req *dashapi.LoadFullBugReq) (interface{}, error) {
+func apiLoadFullBug(c context.Context, req *dashapi.LoadFullBugReq) (any, error) {
bug, bugKey, err := findBugByReportingID(c, req.BugID)
if err != nil {
return nil, fmt.Errorf("failed to find the bug: %w", err)
@@ -1282,7 +1282,7 @@ func loadBugReport(c context.Context, bug *Bug) (*dashapi.BugReport, error) {
return createBugReport(c, bug, crash, crashKey, bugReporting, reporting)
}
-func apiAddBuildAssets(c context.Context, ns string, req *dashapi.AddBuildAssetsReq) (interface{}, error) {
+func apiAddBuildAssets(c context.Context, ns string, req *dashapi.AddBuildAssetsReq) (any, error) {
assets := []Asset{}
for i, toAdd := range req.Assets {
asset, err := parseIncomingAsset(c, toAdd, ns)
@@ -1323,7 +1323,7 @@ func parseIncomingAsset(c context.Context, newAsset dashapi.NewAsset, ns string)
}, nil
}
-func apiNeededAssetsList(c context.Context, req *any) (interface{}, error) {
+func apiNeededAssetsList(c context.Context, req *any) (any, error) {
return queryNeededAssets(c)
}
@@ -1704,7 +1704,7 @@ func handleRefreshSubsystems(w http.ResponseWriter, r *http.Request) {
}
}
-func apiSaveDiscussion(c context.Context, req *dashapi.SaveDiscussionReq) (interface{}, error) {
+func apiSaveDiscussion(c context.Context, req *dashapi.SaveDiscussionReq) (any, error) {
d := req.Discussion
newBugIDs := []string{}
for _, id := range d.BugIDs {
@@ -1743,7 +1743,7 @@ func recordEmergencyStop(c context.Context) error {
// Share crash logs for non-reproduced bugs with syz-managers.
// In future, this can also take care of repro exchange between instances
// in the place of syz-hub.
-func apiLogToReproduce(c context.Context, ns string, req *dashapi.LogToReproReq) (interface{}, error) {
+func apiLogToReproduce(c context.Context, ns string, req *dashapi.LogToReproReq) (any, error) {
build, err := loadBuild(c, ns, req.BuildID)
if err != nil {
return nil, err
@@ -1863,7 +1863,7 @@ func takeReproTask(c context.Context, ns, manager string) ([]byte, error) {
return log, err
}
-func apiCreateUploadURL(c context.Context, req *any) (interface{}, error) {
+func apiCreateUploadURL(c context.Context, req *any) (any, error) {
bucket := getConfig(c).UploadBucket
if bucket == "" {
return nil, errors.New("not configured")
@@ -1871,7 +1871,7 @@ func apiCreateUploadURL(c context.Context, req *any) (interface{}, error) {
return fmt.Sprintf("%s/%s.upload", bucket, uuid.New().String()), nil
}
-func apiSendEmail(c context.Context, req *dashapi.SendEmailReq) (interface{}, error) {
+func apiSendEmail(c context.Context, req *dashapi.SendEmailReq) (any, error) {
var headers mail.Header
if req.InReplyTo != "" {
headers = mail.Header{"In-Reply-To": []string{req.InReplyTo}}
@@ -1889,7 +1889,7 @@ func apiSendEmail(c context.Context, req *dashapi.SendEmailReq) (interface{}, er
// apiSaveCoverage reads jsonl data from payload and stores it to coveragedb.
// First payload jsonl line is a coveragedb.HistoryRecord (w/o session and time).
// Second+ records are coveragedb.JSONLWrapper.
-func apiSaveCoverage(c context.Context, payload io.Reader) (interface{}, error) {
+func apiSaveCoverage(c context.Context, payload io.Reader) (any, error) {
descr := new(coveragedb.HistoryRecord)
jsonDec := json.NewDecoder(payload)
if err := jsonDec.Decode(descr); err != nil {
diff --git a/dashboard/app/coverage.go b/dashboard/app/coverage.go
index 67a4494e0..d10651fef 100644
--- a/dashboard/app/coverage.go
+++ b/dashboard/app/coverage.go
@@ -111,7 +111,7 @@ func getParam[T int | string | bool | civil.Date](r *http.Request, name string,
return extractVal(t, r.FormValue(name)).(T)
}
-func extractVal(t interface{}, val string) interface{} {
+func extractVal(t any, val string) any {
switch t.(type) {
case int:
res, _ := strconv.Atoi(val)
diff --git a/dashboard/app/entities_spanner.go b/dashboard/app/entities_spanner.go
index df1bfeed7..cf21e43eb 100644
--- a/dashboard/app/entities_spanner.go
+++ b/dashboard/app/entities_spanner.go
@@ -44,7 +44,7 @@ from merge_history join files
on merge_history.session = files.session
where namespace=$1 and duration>=$2 and duration<=$3 and manager='*'
group by dateto, duration`,
- Params: map[string]interface{}{
+ Params: map[string]any{
"p1": ns,
"p2": minDays,
"p3": maxDays,
diff --git a/dashboard/app/handler.go b/dashboard/app/handler.go
index 157e33383..bda86eb30 100644
--- a/dashboard/app/handler.go
+++ b/dashboard/app/handler.go
@@ -203,7 +203,7 @@ func handleAuth(fn contextHandler) contextHandler {
}
}
-func serveTemplate(w http.ResponseWriter, name string, data interface{}) error {
+func serveTemplate(w http.ResponseWriter, name string, data any) error {
buf := new(bytes.Buffer)
if err := templates.ExecuteTemplate(buf, name, data); err != nil {
return err
diff --git a/dashboard/app/jobs.go b/dashboard/app/jobs.go
index b7ff881a3..9c1a9001e 100644
--- a/dashboard/app/jobs.go
+++ b/dashboard/app/jobs.go
@@ -1258,7 +1258,7 @@ func pollCompletedJobs(c context.Context, typ string) ([]*dashapi.BugReport, err
return reports, nil
}
-func createBugReportForJob(c context.Context, job *Job, jobKey *db.Key, config interface{}) (
+func createBugReportForJob(c context.Context, job *Job, jobKey *db.Key, config any) (
*dashapi.BugReport, error) {
reportingConfig, err := json.Marshal(config)
if err != nil {
diff --git a/dashboard/app/label.go b/dashboard/app/label.go
index cbff8c33e..807951f48 100644
--- a/dashboard/app/label.go
+++ b/dashboard/app/label.go
@@ -32,7 +32,7 @@ type subsetOf []string
type trueFalse struct{}
func makeLabelSet(c context.Context, ns string) *labelSet {
- ret := map[BugLabelType]interface{}{
+ ret := map[BugLabelType]any{
PriorityLabel: oneOf([]string{
string(LowPrioBug),
string(NormalPrioBug),
@@ -74,7 +74,7 @@ func makeLabelSet(c context.Context, ns string) *labelSet {
type labelSet struct {
c context.Context
ns string
- labels map[BugLabelType]interface{}
+ labels map[BugLabelType]any
}
func (s *labelSet) FindLabel(label BugLabelType) bool {
diff --git a/dashboard/app/main.go b/dashboard/app/main.go
index 0d2e588b1..3b1749a45 100644
--- a/dashboard/app/main.go
+++ b/dashboard/app/main.go
@@ -318,7 +318,7 @@ type uiCollapsible struct {
Title string
Show bool // By default it's collapsed.
Type string // Template system understands it.
- Value interface{}
+ Value any
}
func makeCollapsibleBugJobs(title string, jobs []*uiJob) *uiCollapsible {
@@ -1411,7 +1411,7 @@ func handleBugSummaries(c context.Context, w http.ResponseWriter, r *http.Reques
return json.NewEncoder(w).Encode(list)
}
-func writeJSONVersionOf(writer http.ResponseWriter, page interface{}) error {
+func writeJSONVersionOf(writer http.ResponseWriter, page any) error {
data, err := GetJSONDescrFor(page)
if err != nil {
return err
diff --git a/dashboard/app/public_json_api.go b/dashboard/app/public_json_api.go
index 5905ec8c6..75c688954 100644
--- a/dashboard/app/public_json_api.go
+++ b/dashboard/app/public_json_api.go
@@ -161,8 +161,8 @@ func getExtAPIDescrForBackports(groups []*uiBackportGroup) *publicAPIBackports {
}
}
-func GetJSONDescrFor(page interface{}) ([]byte, error) {
- var res interface{}
+func GetJSONDescrFor(page any) ([]byte, error) {
+ var res any
switch i := page.(type) {
case *uiBugPage:
res = getExtAPIDescrForBugPage(i)
diff --git a/dashboard/app/reporting_external.go b/dashboard/app/reporting_external.go
index 8dd4eb444..3bfc5f445 100644
--- a/dashboard/app/reporting_external.go
+++ b/dashboard/app/reporting_external.go
@@ -15,7 +15,7 @@ import (
// The external system is meant to poll for new bugs with apiReportingPoll,
// and report back bug status updates with apiReportingUpdate.
-func apiReportingPollBugs(c context.Context, req *dashapi.PollBugsRequest) (interface{}, error) {
+func apiReportingPollBugs(c context.Context, req *dashapi.PollBugsRequest) (any, error) {
if stop, err := emergentlyStopped(c); err != nil || stop {
return &dashapi.PollBugsResponse{}, err
}
@@ -32,7 +32,7 @@ func apiReportingPollBugs(c context.Context, req *dashapi.PollBugsRequest) (inte
}
func apiReportingPollNotifications(c context.Context, req *dashapi.PollNotificationsRequest) (
- interface{}, error) {
+ any, error) {
if stop, err := emergentlyStopped(c); err != nil || stop {
return &dashapi.PollNotificationsResponse{}, err
}
@@ -43,7 +43,7 @@ func apiReportingPollNotifications(c context.Context, req *dashapi.PollNotificat
return resp, nil
}
-func apiReportingPollClosed(c context.Context, req *dashapi.PollClosedRequest) (interface{}, error) {
+func apiReportingPollClosed(c context.Context, req *dashapi.PollClosedRequest) (any, error) {
if stop, err := emergentlyStopped(c); err != nil || stop {
return &dashapi.PollClosedResponse{}, err
}
@@ -57,7 +57,7 @@ func apiReportingPollClosed(c context.Context, req *dashapi.PollClosedRequest) (
return resp, nil
}
-func apiReportingUpdate(c context.Context, req *dashapi.BugUpdate) (interface{}, error) {
+func apiReportingUpdate(c context.Context, req *dashapi.BugUpdate) (any, error) {
if req.JobID != "" {
resp := &dashapi.BugUpdateReply{
OK: true,
@@ -78,7 +78,7 @@ func apiReportingUpdate(c context.Context, req *dashapi.BugUpdate) (interface{},
}, nil
}
-func apiNewTestJob(c context.Context, req *dashapi.TestPatchRequest) (interface{}, error) {
+func apiNewTestJob(c context.Context, req *dashapi.TestPatchRequest) (any, error) {
resp := &dashapi.TestPatchReply{}
err := handleExternalTestRequest(c, req)
if err != nil {
diff --git a/dashboard/app/subsystem.go b/dashboard/app/subsystem.go
index c49bc081b..48ee1f785 100644
--- a/dashboard/app/subsystem.go
+++ b/dashboard/app/subsystem.go
@@ -108,7 +108,7 @@ type (
)
func updateBugSubsystems(c context.Context, bugKey *db.Key,
- list []*subsystem.Subsystem, info interface{}) error {
+ list []*subsystem.Subsystem, info any) error {
now := timeNow(c)
return updateSingleBug(c, bugKey, func(bug *Bug) error {
switch v := info.(type) {
diff --git a/dashboard/app/tree.go b/dashboard/app/tree.go
index a6a9e9e30..b6261e289 100644
--- a/dashboard/app/tree.go
+++ b/dashboard/app/tree.go
@@ -94,7 +94,7 @@ func treeOriginJobDone(cGlobal context.Context, jobKey *db.Key, job *Job) error
return runInTransaction(cGlobal, tx, &db.TransactionOptions{XG: true})
}
-type pollTreeJobResult interface{}
+type pollTreeJobResult any
// pollResultPending is returned when we wait some job to finish.
type pollResultPending struct{}
@@ -371,7 +371,7 @@ func (ctx *bugTreeContext) groupResults(results []pollTreeJobResult) pollTreeJob
return pollResultSkip{}
}
-type expectedResult interface{}
+type expectedResult any
// resultFreshness subtypes.
type wantFirstOK struct{}
@@ -379,7 +379,7 @@ type wantFirstCrash struct{}
type wantFirstAny struct{}
type wantNewAny time.Time
-type runReproOn interface{}
+type runReproOn any
// runReproOn subtypes.
type runOnAny struct{} // attempts to find any result, if unsuccessful, runs on HEAD
diff --git a/dashboard/app/util_test.go b/dashboard/app/util_test.go
index 199573cf0..9fd4d3b81 100644
--- a/dashboard/app/util_test.go
+++ b/dashboard/app/util_test.go
@@ -125,14 +125,14 @@ func (c *Ctx) expectBadReqest(err error) {
expectFailureStatus(c.t, err, http.StatusBadRequest)
}
-func (c *Ctx) expectEQ(got, want interface{}) {
+func (c *Ctx) expectEQ(got, want any) {
if diff := cmp.Diff(got, want); diff != "" {
c.t.Helper()
c.t.Fatal(diff)
}
}
-func (c *Ctx) expectNE(got, want interface{}) {
+func (c *Ctx) expectNE(got, want any) {
if reflect.DeepEqual(got, want) {
c.t.Helper()
c.t.Fatalf("equal: %#v", got)
@@ -504,8 +504,8 @@ type apiClient struct {
}
func (c *Ctx) makeClient(client, key string, failOnErrors bool) *apiClient {
- logger := func(msg string, args ...interface{}) {
- c.t.Logf("%v: "+msg, append([]interface{}{caller(3)}, args...)...)
+ logger := func(msg string, args ...any) {
+ c.t.Logf("%v: "+msg, append([]any{caller(3)}, args...)...)
}
errorHandler := func(err error) {
if failOnErrors {
@@ -628,7 +628,7 @@ type (
EmailOptSender string
)
-func (c *Ctx) incomingEmail(to, body string, opts ...interface{}) {
+func (c *Ctx) incomingEmail(to, body string, opts ...any) {
id := 0
subject := "crash1"
from := "default@sender.com"
diff --git a/dashboard/dashapi/dashapi.go b/dashboard/dashapi/dashapi.go
index 1f9dec94d..84b90eb97 100644
--- a/dashboard/dashapi/dashapi.go
+++ b/dashboard/dashapi/dashapi.go
@@ -54,7 +54,7 @@ func New(client, addr, key string, opts ...DashboardOpts) (*Dashboard, error) {
type (
RequestCtor func(method, url string, body io.Reader) (*http.Request, error)
RequestDoer func(req *http.Request) (*http.Response, error)
- RequestLogger func(msg string, args ...interface{})
+ RequestLogger func(msg string, args ...any)
)
// key == "" indicates that the ambient GCE service account authority
@@ -407,7 +407,7 @@ type LogEntry struct {
}
// Centralized logging on dashboard.
-func (dash *Dashboard) LogError(name, msg string, args ...interface{}) {
+func (dash *Dashboard) LogError(name, msg string, args ...any) {
req := &LogEntry{
Name: name,
Text: fmt.Sprintf(msg, args...),
@@ -988,7 +988,7 @@ type JobInfo struct {
OnMergeBase bool
}
-func (dash *Dashboard) Query(method string, req, reply interface{}) error {
+func (dash *Dashboard) Query(method string, req, reply any) error {
if dash.logger != nil {
dash.logger("API(%v): %#v", method, req)
}
@@ -1008,7 +1008,7 @@ func (dash *Dashboard) Query(method string, req, reply interface{}) error {
return nil
}
-func (dash *Dashboard) queryImpl(method string, req, reply interface{}) error {
+func (dash *Dashboard) queryImpl(method string, req, reply any) error {
if reply != nil {
// json decoding behavior is somewhat surprising
// (see // https://github.com/golang/go/issues/21092).
diff --git a/pkg/ast/parser_test.go b/pkg/ast/parser_test.go
index bc66ed4be..199bd7490 100644
--- a/pkg/ast/parser_test.go
+++ b/pkg/ast/parser_test.go
@@ -97,24 +97,24 @@ func TestParse(t *testing.T) {
var parseTests = []struct {
name string
input string
- result []interface{}
+ result []any
}{
{
"empty",
``,
- []interface{}{},
+ []any{},
},
{
"new-line",
`
`,
- []interface{}{},
+ []any{},
},
{
"nil",
"\x00",
- []interface{}{},
+ []any{},
},
}
diff --git a/pkg/ast/scanner.go b/pkg/ast/scanner.go
index 67dd80e52..326a0b9bb 100644
--- a/pkg/ast/scanner.go
+++ b/pkg/ast/scanner.go
@@ -289,7 +289,7 @@ func (s *scanner) scanIdent(pos Pos) (tok token, lit string) {
return
}
-func (s *scanner) Errorf(pos Pos, msg string, args ...interface{}) {
+func (s *scanner) Errorf(pos Pos, msg string, args ...any) {
s.errors++
s.errorHandler(pos, fmt.Sprintf(msg, args...))
}
diff --git a/pkg/bisect/bisect.go b/pkg/bisect/bisect.go
index a37436495..adf2bd971 100644
--- a/pkg/bisect/bisect.go
+++ b/pkg/bisect/bisect.go
@@ -1057,7 +1057,7 @@ func (env *env) log(msg string) {
env.logf("%v", msg)
}
-func (env *env) logf(msg string, args ...interface{}) {
+func (env *env) logf(msg string, args ...any) {
if false {
_ = fmt.Sprintf(msg, args...) // enable printf checker
}
diff --git a/pkg/bisect/minimize/slice.go b/pkg/bisect/minimize/slice.go
index d5fbc6c6a..949174ad4 100644
--- a/pkg/bisect/minimize/slice.go
+++ b/pkg/bisect/minimize/slice.go
@@ -24,7 +24,7 @@ type Config[T any] struct {
// anongside the intermediate bisection result (a valid, but not fully minimized slice).
MaxChunks int
// Logf is used for sharing debugging output.
- Logf func(string, ...interface{})
+ Logf func(string, ...any)
}
// Slice() finds a minimal subsequence of slice elements that still gives Pred() == true.
@@ -33,7 +33,7 @@ type Config[T any] struct {
// The expected number of Pred() runs is O(|result|*log2(|elements|)).
func Slice[T any](config Config[T], slice []T) ([]T, error) {
if config.Logf == nil {
- config.Logf = func(string, ...interface{}) {}
+ config.Logf = func(string, ...any) {}
}
ctx := &sliceCtx[T]{
Config: config,
diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go
index 3022def7f..7b22cef42 100644
--- a/pkg/compiler/compiler.go
+++ b/pkg/compiler/compiler.go
@@ -148,12 +148,12 @@ type warn struct {
msg string
}
-func (comp *compiler) error(pos ast.Pos, msg string, args ...interface{}) {
+func (comp *compiler) error(pos ast.Pos, msg string, args ...any) {
comp.errors++
comp.eh(pos, fmt.Sprintf(msg, args...))
}
-func (comp *compiler) warning(pos ast.Pos, msg string, args ...interface{}) {
+func (comp *compiler) warning(pos ast.Pos, msg string, args ...any) {
comp.warnings = append(comp.warnings, warn{pos, fmt.Sprintf(msg, args...)})
}
diff --git a/pkg/compiler/const_file.go b/pkg/compiler/const_file.go
index 0220da555..620c73f7b 100644
--- a/pkg/compiler/const_file.go
+++ b/pkg/compiler/const_file.go
@@ -204,7 +204,7 @@ func DeserializeConstFile(glob string, eh ast.ErrorHandler) *ConstFile {
func (cf *ConstFile) deserializeFile(data []byte, file, arch string, eh ast.ErrorHandler) bool {
pos := ast.Pos{File: file, Line: 1}
- errf := func(msg string, args ...interface{}) bool {
+ errf := func(msg string, args ...any) bool {
eh(pos, fmt.Sprintf(msg, args...))
return false
}
@@ -247,7 +247,7 @@ func (cf *ConstFile) deserializeFile(data []byte, file, arch string, eh ast.Erro
return true
}
-type errft func(msg string, args ...interface{}) bool
+type errft func(msg string, args ...any) bool
func (cf *ConstFile) parseConst(arches []string, name, line string, weak bool, errf errft) bool {
var dflt map[string]uint64
diff --git a/pkg/config/config.go b/pkg/config/config.go
index 5af99ba0f..0a0346f83 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -13,7 +13,7 @@ import (
"github.com/google/syzkaller/pkg/osutil"
)
-func LoadFile(filename string, cfg interface{}) error {
+func LoadFile(filename string, cfg any) error {
if filename == "" {
return fmt.Errorf("no config file specified")
}
@@ -24,7 +24,7 @@ func LoadFile(filename string, cfg interface{}) error {
return LoadData(data, cfg)
}
-func LoadData(data []byte, cfg interface{}) error {
+func LoadData(data []byte, cfg any) error {
// Remove comment lines starting with #.
data = regexp.MustCompile(`(^|\n)\s*#[^\n]*`).ReplaceAll(data, nil)
dec := json.NewDecoder(bytes.NewReader(data))
@@ -35,7 +35,7 @@ func LoadData(data []byte, cfg interface{}) error {
return nil
}
-func SaveFile(filename string, cfg interface{}) error {
+func SaveFile(filename string, cfg any) error {
data, err := json.MarshalIndent(cfg, "", "\t")
if err != nil {
return err
diff --git a/pkg/config/merge.go b/pkg/config/merge.go
index 3d8193c02..ae4320946 100644
--- a/pkg/config/merge.go
+++ b/pkg/config/merge.go
@@ -23,7 +23,7 @@ func MergeJSONs(left, right []byte) ([]byte, error) {
// Recursively apply a patch to a raw JSON data.
// Patch is supposed to be a map, which possibly nests other map objects.
-func PatchJSON(left []byte, patch map[string]interface{}) ([]byte, error) {
+func PatchJSON(left []byte, patch map[string]any) ([]byte, error) {
vLeft, err := parseFragment(left)
if err != nil {
return nil, err
@@ -31,7 +31,7 @@ func PatchJSON(left []byte, patch map[string]interface{}) ([]byte, error) {
return json.Marshal(mergeRecursive(vLeft, patch))
}
-func parseFragment(input []byte) (parsed interface{}, err error) {
+func parseFragment(input []byte) (parsed any, err error) {
if len(input) == 0 {
// For convenience, we allow empty strings to be passed to the function that merges JSONs.
return
@@ -42,15 +42,15 @@ func parseFragment(input []byte) (parsed interface{}, err error) {
// If one of the elements is not a map, use the new one.
// Otherwise, recursively merge map elements.
-func mergeRecursive(left, right interface{}) interface{} {
+func mergeRecursive(left, right any) any {
if left == nil {
return right
}
if right == nil {
return left
}
- mLeft, okLeft := left.(map[string]interface{})
- mRight, okRight := right.(map[string]interface{})
+ mLeft, okLeft := left.(map[string]any)
+ mRight, okRight := right.(map[string]any)
if !okLeft || !okRight {
return right
}
diff --git a/pkg/config/merge_test.go b/pkg/config/merge_test.go
index 6785534f1..53d8a2116 100644
--- a/pkg/config/merge_test.go
+++ b/pkg/config/merge_test.go
@@ -51,19 +51,19 @@ func TestMergeJSONs(t *testing.T) {
func TestPatchJSON(t *testing.T) {
tests := []struct {
left string
- patch map[string]interface{}
+ patch map[string]any
result string
}{
{
`{"a":1,"b":2}`,
- map[string]interface{}{"b": "string val"},
+ map[string]any{"b": "string val"},
`{"a":1,"b":"string val"}`,
},
{
`{"a":1,"b":2}`,
- map[string]interface{}{
- "a": map[string]interface{}{
- "b": map[string]interface{}{
+ map[string]any{
+ "a": map[string]any{
+ "b": map[string]any{
"c": 5,
},
},
@@ -72,9 +72,9 @@ func TestPatchJSON(t *testing.T) {
},
{
`{}`,
- map[string]interface{}{
- "a": map[string]interface{}{
- "b": map[string]interface{}{
+ map[string]any{
+ "a": map[string]any{
+ "b": map[string]any{
"c": 0,
},
},
diff --git a/pkg/coveragedb/coveragedb.go b/pkg/coveragedb/coveragedb.go
index 8272ce6ff..7ae10047b 100644
--- a/pkg/coveragedb/coveragedb.go
+++ b/pkg/coveragedb/coveragedb.go
@@ -149,7 +149,7 @@ from merge_history
on merge_history.session = files.session
where
namespace=$1 and dateto=$2 and duration=$3 and filepath=$4 and commit=$5 and manager=$6`,
- Params: map[string]interface{}{
+ Params: map[string]any{
"p1": ns,
"p2": timePeriod.DateTo,
"p3": timePeriod.Days,
@@ -267,7 +267,7 @@ func NsDataMerged(ctx context.Context, client spannerclient.SpannerClient, ns st
from merge_history
where
namespace=$1`,
- Params: map[string]interface{}{
+ Params: map[string]any{
"p1": ns,
},
}
@@ -485,7 +485,7 @@ from merge_history
on merge_history.namespace = file_subsystems.namespace and files.filepath = file_subsystems.filepath
where
merge_history.namespace=$1 and dateto=$2 and duration=$3 and manager=$4`,
- Params: map[string]interface{}{
+ Params: map[string]any{
"p1": scope.Ns,
"p2": scope.Periods[0].DateTo,
"p3": scope.Periods[0].Days,
@@ -647,7 +647,7 @@ func RegenerateSubsystems(ctx context.Context, ns string, sss []*subsystem.Subsy
func getFilePaths(ctx context.Context, ns string, client spannerclient.SpannerClient) ([]string, error) {
iter := client.Single().Query(ctx, spanner.Statement{
SQL: `select filepath from file_subsystems where namespace=$1`,
- Params: map[string]interface{}{
+ Params: map[string]any{
"p1": ns,
},
})
diff --git a/pkg/coveragedb/functions.go b/pkg/coveragedb/functions.go
index 6e1240881..929f2a620 100644
--- a/pkg/coveragedb/functions.go
+++ b/pkg/coveragedb/functions.go
@@ -30,7 +30,7 @@ from merge_history
on merge_history.session = functions.session
where
merge_history.namespace=$1 and dateto=$2 and duration=$3`,
- Params: map[string]interface{}{
+ Params: map[string]any{
"p1": ns,
"p2": timePeriod.DateTo,
"p3": timePeriod.Days,
diff --git a/pkg/coveragedb/mocks/Row.go b/pkg/coveragedb/mocks/Row.go
index 3ea716173..0359f6031 100644
--- a/pkg/coveragedb/mocks/Row.go
+++ b/pkg/coveragedb/mocks/Row.go
@@ -36,7 +36,7 @@ func (_m *Row) EXPECT() *Row_Expecter {
}
// ToStruct provides a mock function for the type Row
-func (_mock *Row) ToStruct(p interface{}) error {
+func (_mock *Row) ToStruct(p any) error {
ret := _mock.Called(p)
if len(ret) == 0 {
@@ -44,7 +44,7 @@ func (_mock *Row) ToStruct(p interface{}) error {
}
var r0 error
- if returnFunc, ok := ret.Get(0).(func(interface{}) error); ok {
+ if returnFunc, ok := ret.Get(0).(func(any) error); ok {
r0 = returnFunc(p)
} else {
r0 = ret.Error(0)
@@ -58,16 +58,16 @@ type Row_ToStruct_Call struct {
}
// ToStruct is a helper method to define mock.On call
-// - p interface{}
+// - p any
func (_e *Row_Expecter) ToStruct(p interface{}) *Row_ToStruct_Call {
return &Row_ToStruct_Call{Call: _e.mock.On("ToStruct", p)}
}
-func (_c *Row_ToStruct_Call) Run(run func(p interface{})) *Row_ToStruct_Call {
+func (_c *Row_ToStruct_Call) Run(run func(p any)) *Row_ToStruct_Call {
_c.Call.Run(func(args mock.Arguments) {
- var arg0 interface{}
+ var arg0 any
if args[0] != nil {
- arg0 = args[0].(interface{})
+ arg0 = args[0].(any)
}
run(
arg0,
@@ -81,7 +81,7 @@ func (_c *Row_ToStruct_Call) Return(err error) *Row_ToStruct_Call {
return _c
}
-func (_c *Row_ToStruct_Call) RunAndReturn(run func(p interface{}) error) *Row_ToStruct_Call {
+func (_c *Row_ToStruct_Call) RunAndReturn(run func(p any) error) *Row_ToStruct_Call {
_c.Call.Return(run)
return _c
}
diff --git a/pkg/coveragedb/spannerclient/spanner_client.go b/pkg/coveragedb/spannerclient/spanner_client.go
index 4f655c6ed..d9409381d 100644
--- a/pkg/coveragedb/spannerclient/spanner_client.go
+++ b/pkg/coveragedb/spannerclient/spanner_client.go
@@ -26,7 +26,7 @@ type RowIterator interface {
}
type Row interface {
- ToStruct(p interface{}) error
+ ToStruct(p any) error
}
type SpannerClientProxy struct {
diff --git a/pkg/debugtracer/debug.go b/pkg/debugtracer/debug.go
index 10259e788..fa30c244a 100644
--- a/pkg/debugtracer/debug.go
+++ b/pkg/debugtracer/debug.go
@@ -14,7 +14,7 @@ import (
)
type DebugTracer interface {
- Log(msg string, args ...interface{})
+ Log(msg string, args ...any)
SaveFile(filename string, data []byte)
}
@@ -31,10 +31,10 @@ type TestTracer struct {
type NullTracer struct {
}
-func (gt *GenericTracer) Log(msg string, args ...interface{}) {
+func (gt *GenericTracer) Log(msg string, args ...any) {
if gt.WithTime {
timeStr := time.Now().Format("02-Jan-2006 15:04:05")
- newArgs := append([]interface{}{timeStr}, args...)
+ newArgs := append([]any{timeStr}, args...)
fmt.Fprintf(gt.TraceWriter, "%s: "+msg+"\n", newArgs...)
} else {
fmt.Fprintf(gt.TraceWriter, msg+"\n", args...)
@@ -49,7 +49,7 @@ func (gt *GenericTracer) SaveFile(filename string, data []byte) {
osutil.WriteFile(filepath.Join(gt.OutDir, filename), data)
}
-func (tt *TestTracer) Log(msg string, args ...interface{}) {
+func (tt *TestTracer) Log(msg string, args ...any) {
tt.T.Log(msg, args)
}
@@ -57,7 +57,7 @@ func (tt *TestTracer) SaveFile(filename string, data []byte) {
// Not implemented.
}
-func (nt *NullTracer) Log(msg string, args ...interface{}) {
+func (nt *NullTracer) Log(msg string, args ...any) {
// Not implemented.
}
diff --git a/pkg/fuzzer/fuzzer.go b/pkg/fuzzer/fuzzer.go
index fdfe95518..bd55ca9c6 100644
--- a/pkg/fuzzer/fuzzer.go
+++ b/pkg/fuzzer/fuzzer.go
@@ -210,7 +210,7 @@ func (fuzzer *Fuzzer) processResult(req *queue.Request, res *queue.Result, flags
type Config struct {
Debug bool
Corpus *corpus.Corpus
- Logf func(level int, msg string, args ...interface{})
+ Logf func(level int, msg string, args ...any)
Snapshot bool
Coverage bool
FaultInjection bool
@@ -338,7 +338,7 @@ func (fuzzer *Fuzzer) Next() *queue.Request {
return req
}
-func (fuzzer *Fuzzer) Logf(level int, msg string, args ...interface{}) {
+func (fuzzer *Fuzzer) Logf(level int, msg string, args ...any) {
if fuzzer.Config.Logf == nil {
return
}
diff --git a/pkg/fuzzer/fuzzer_test.go b/pkg/fuzzer/fuzzer_test.go
index b12d7634b..971e6d683 100644
--- a/pkg/fuzzer/fuzzer_test.go
+++ b/pkg/fuzzer/fuzzer_test.go
@@ -49,7 +49,7 @@ func TestFuzz(t *testing.T) {
fuzzer := NewFuzzer(ctx, &Config{
Debug: true,
Corpus: corpus.NewMonitoredCorpus(ctx, corpusUpdates),
- Logf: func(level int, msg string, args ...interface{}) {
+ Logf: func(level int, msg string, args ...any) {
if level > 1 {
return
}
diff --git a/pkg/html/html.go b/pkg/html/html.go
index e077153d1..0da3674ea 100644
--- a/pkg/html/html.go
+++ b/pkg/html/html.go
@@ -205,7 +205,7 @@ func formatStringList(list []string) string {
return strings.Join(list, ", ")
}
-func dereferencePointer(v interface{}) interface{} {
+func dereferencePointer(v any) any {
reflectValue := reflect.ValueOf(v)
if !reflectValue.IsNil() && reflectValue.Kind() == reflect.Ptr {
elem := reflectValue.Elem()
diff --git a/pkg/ifuzz/x86/gen/gen.go b/pkg/ifuzz/x86/gen/gen.go
index c1af7a44e..b79b8dabf 100644
--- a/pkg/ifuzz/x86/gen/gen.go
+++ b/pkg/ifuzz/x86/gen/gen.go
@@ -39,7 +39,7 @@ func main() {
var insn, insn1 *x86.Insn
s := bufio.NewScanner(f)
for i := 1; s.Scan(); i++ {
- reportError := func(msg string, args ...interface{}) {
+ reportError := func(msg string, args ...any) {
fmt.Fprintf(os.Stderr, "line %v: %v\n", i, s.Text())
tool.Failf(msg, args...)
}
diff --git a/pkg/image/compression_optimized.go b/pkg/image/compression_optimized.go
index 819debc6e..e9effb477 100644
--- a/pkg/image/compression_optimized.go
+++ b/pkg/image/compression_optimized.go
@@ -25,7 +25,7 @@ type decompressScratch struct {
// This is just for memory consumption estimation, does not need to be precise.
const pageSize = 4 << 10
-var decompressPool = sync.Pool{New: func() interface{} {
+var decompressPool = sync.Pool{New: func() any {
return &decompressScratch{
buf: make([]byte, pageSize),
}
diff --git a/pkg/instance/execprog.go b/pkg/instance/execprog.go
index 564889ba2..6a365cdb7 100644
--- a/pkg/instance/execprog.go
+++ b/pkg/instance/execprog.go
@@ -18,7 +18,7 @@ import (
"github.com/google/syzkaller/vm"
)
-type ExecutorLogger func(int, string, ...interface{})
+type ExecutorLogger func(int, string, ...any)
type OptionalConfig struct {
Logf ExecutorLogger
@@ -84,7 +84,7 @@ func SetupExecProg(vmInst *vm.Instance, mgrCfg *mgrconfig.Config, reporter *repo
}
}
if ret.Logf == nil {
- ret.Logf = func(int, string, ...interface{}) {}
+ ret.Logf = func(int, string, ...any) {}
}
return ret, nil
}
diff --git a/pkg/instance/instance.go b/pkg/instance/instance.go
index 1d0adc5d6..d8b3a8f71 100644
--- a/pkg/instance/instance.go
+++ b/pkg/instance/instance.go
@@ -193,7 +193,7 @@ func SetConfigImage(cfg *mgrconfig.Config, imageDir string, reliable bool) error
if keyFile := filepath.Join(imageDir, "key"); osutil.IsExist(keyFile) {
cfg.SSHKey = keyFile
}
- vmConfig := make(map[string]interface{})
+ vmConfig := make(map[string]any)
if err := json.Unmarshal(cfg.VM, &vmConfig); err != nil {
return fmt.Errorf("failed to parse VM config: %w", err)
}
@@ -218,7 +218,7 @@ func SetConfigImage(cfg *mgrconfig.Config, imageDir string, reliable bool) error
}
func OverrideVMCount(cfg *mgrconfig.Config, n int) error {
- vmConfig := make(map[string]interface{})
+ vmConfig := make(map[string]any)
if err := json.Unmarshal(cfg.VM, &vmConfig); err != nil {
return fmt.Errorf("failed to parse VM config: %w", err)
}
diff --git a/pkg/kconfig/parser.go b/pkg/kconfig/parser.go
index 60bfc54a1..08c9600ce 100644
--- a/pkg/kconfig/parser.go
+++ b/pkg/kconfig/parser.go
@@ -77,7 +77,7 @@ func (p *parser) identLevel() int {
return level
}
-func (p *parser) failf(msg string, args ...interface{}) {
+func (p *parser) failf(msg string, args ...any) {
if p.err == nil {
p.err = fmt.Errorf("%v:%v:%v: %v\n%v", p.file, p.line, p.col, fmt.Sprintf(msg, args...), p.current)
}
diff --git a/pkg/log/log.go b/pkg/log/log.go
index 19ff6fd9b..e2edf02b4 100644
--- a/pkg/log/log.go
+++ b/pkg/log/log.go
@@ -79,7 +79,7 @@ func Log(v int, msg string) {
Logf(v, "%v", msg)
}
-func Logf(v int, msg string, args ...interface{}) {
+func Logf(v int, msg string, args ...any) {
writeMessage(v, "", msg, args...)
}
@@ -87,7 +87,7 @@ func Error(err error) {
Errorf("%v", err)
}
-func Errorf(msg string, args ...interface{}) {
+func Errorf(msg string, args ...any) {
writeMessage(0, "ERROR", msg, args...)
}
@@ -95,11 +95,11 @@ func Fatal(err error) {
Fatalf("%v", err)
}
-func Fatalf(msg string, args ...interface{}) {
+func Fatalf(msg string, args ...any) {
golog.Fatal(message("FATAL", msg, args...))
}
-func message(severity, msg string, args ...interface{}) string {
+func message(severity, msg string, args ...any) string {
var sb strings.Builder
if severity != "" {
fmt.Fprintf(&sb, "[%s] ", severity)
@@ -111,7 +111,7 @@ func message(severity, msg string, args ...interface{}) string {
return sb.String()
}
-func writeMessage(v int, severity, msg string, args ...interface{}) {
+func writeMessage(v int, severity, msg string, args ...any) {
cache := v <= 1 && cachingEnabled.Load()
if !V(v) && !cache {
return
diff --git a/pkg/manager/diff.go b/pkg/manager/diff.go
index 18dd0df48..4ad759244 100644
--- a/pkg/manager/diff.go
+++ b/pkg/manager/diff.go
@@ -564,7 +564,7 @@ func (kc *kernelContext) setupFuzzer(features flatrpc.Feature, syscalls map[*pro
EnabledCalls: syscalls,
NoMutateCalls: kc.cfg.NoMutateCalls,
PatchTest: true,
- Logf: func(level int, msg string, args ...interface{}) {
+ Logf: func(level int, msg string, args ...any) {
if level != 0 {
return
}
diff --git a/pkg/manager/http.go b/pkg/manager/http.go
index 881c8154d..3e47994c3 100644
--- a/pkg/manager/http.go
+++ b/pkg/manager/http.go
@@ -1034,7 +1034,7 @@ func reproStatus(hasRepro, hasCRepro, reproducing, nonReproducible bool) string
return status
}
-func executeTemplate(w http.ResponseWriter, templ *template.Template, data interface{}) {
+func executeTemplate(w http.ResponseWriter, templ *template.Template, data any) {
buf := new(bytes.Buffer)
if err := templ.Execute(buf, data); err != nil {
log.Logf(0, "failed to execute template: %v", err)
diff --git a/pkg/mgrconfig/mgrconfig_test.go b/pkg/mgrconfig/mgrconfig_test.go
index d4a37e941..2873bff20 100644
--- a/pkg/mgrconfig/mgrconfig_test.go
+++ b/pkg/mgrconfig/mgrconfig_test.go
@@ -25,7 +25,7 @@ func TestCanned(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- var vmCfg interface{}
+ var vmCfg any
switch cfg.Type {
case "qemu":
vmCfg = new(qemu.Config)
diff --git a/pkg/repro/repro.go b/pkg/repro/repro.go
index b10d29784..9442acfb2 100644
--- a/pkg/repro/repro.go
+++ b/pkg/repro/repro.go
@@ -51,7 +51,7 @@ type Stats struct {
type reproContext struct {
ctx context.Context
exec execInterface
- logf func(string, ...interface{})
+ logf func(string, ...any)
target *targets.Target
crashTitle string
crashType crash.Type
@@ -82,7 +82,7 @@ type Environment struct {
// it skips multiple simpifications and C repro generation.
Fast bool
- logf func(string, ...interface{})
+ logf func(string, ...any)
}
func Run(ctx context.Context, log []byte, env Environment) (*Result, *Stats, error) {
@@ -766,7 +766,7 @@ func (ctx *reproContext) testCProg(p *prog.Prog, duration time.Duration, opts cs
}, strict)
}
-func (ctx *reproContext) reproLogf(level int, format string, args ...interface{}) {
+func (ctx *reproContext) reproLogf(level int, format string, args ...any) {
if ctx.logf != nil {
ctx.logf(format, args...)
}
@@ -795,7 +795,7 @@ func (ctx *reproContext) bisectProgs(progs []*prog.LogEntry, pred func([]*prog.L
ret, err := minimize.SliceWithFixed(minimize.Config[*prog.LogEntry]{
Pred: minimizePred,
MaxChunks: chunks,
- Logf: func(msg string, args ...interface{}) {
+ Logf: func(msg string, args ...any) {
ctx.reproLogf(3, "bisect: "+msg, args...)
},
}, progs, func(elem *prog.LogEntry) bool {
diff --git a/pkg/rpctype/rpc.go b/pkg/rpctype/rpc.go
index f3a05eeae..2f666c0f3 100644
--- a/pkg/rpctype/rpc.go
+++ b/pkg/rpctype/rpc.go
@@ -19,7 +19,7 @@ type RPCServer struct {
s *rpc.Server
}
-func NewRPCServer(addr, name string, receiver interface{}) (*RPCServer, error) {
+func NewRPCServer(addr, name string, receiver any) (*RPCServer, error) {
ln, err := net.Listen("tcp", addr)
if err != nil {
return nil, fmt.Errorf("failed to listen on %v: %w", addr, err)
@@ -69,7 +69,7 @@ func NewRPCClient(addr string) (*RPCClient, error) {
return cli, nil
}
-func (cli *RPCClient) Call(method string, args, reply interface{}) error {
+func (cli *RPCClient) Call(method string, args, reply any) error {
// Note: SetDeadline is not implemented on fuchsia, so don't fail on error.
cli.conn.SetDeadline(time.Now().Add(10 * time.Minute))
defer cli.conn.SetDeadline(time.Time{})
diff --git a/pkg/runtest/run.go b/pkg/runtest/run.go
index ffd791c68..7b3f1517f 100644
--- a/pkg/runtest/run.go
+++ b/pkg/runtest/run.go
@@ -80,7 +80,7 @@ func (ctx *Context) Init() {
ctx.buildSem = make(chan bool, runtime.GOMAXPROCS(0))
}
-func (ctx *Context) log(msg string, args ...interface{}) {
+func (ctx *Context) log(msg string, args ...any) {
ctx.LogFunc(fmt.Sprintf(msg, args...))
}
diff --git a/pkg/serializer/serializer.go b/pkg/serializer/serializer.go
index 3f7770009..c9063c510 100644
--- a/pkg/serializer/serializer.go
+++ b/pkg/serializer/serializer.go
@@ -16,7 +16,7 @@ import (
// does not write package names before types, omits struct fields with default values,
// omits type names where possible, etc. On the other hand, it currently does not
// support all types (e.g. channels and maps).
-func Write(ww io.Writer, i interface{}) {
+func Write(ww io.Writer, i any) {
w := writer{ww}
v := reflect.ValueOf(i)
if v.Kind() == reflect.Slice && (v.IsNil() || v.Len() == 0) {
@@ -27,7 +27,7 @@ func Write(ww io.Writer, i interface{}) {
w.do(v, false)
}
-func WriteString(i interface{}) string {
+func WriteString(i any) string {
var sb strings.Builder
Write(&sb, i)
return sb.String()
@@ -92,7 +92,7 @@ func (w *writer) doInterface(v reflect.Value) {
elem := v.Elem()
// Handling of user types that has underlying primitive types. Consider:
// type T int
- // var obj interface{} = T(42)
+ // var obj any = T(42)
// T has kind reflect.Int. But if we serialize obj as just "42", it will be turned into plain int.
// Detect this case and serialize obj as "T(42)".
if (elem.Kind() == reflect.Bool || elem.Kind() == reflect.String ||
diff --git a/pkg/serializer/serializer_test.go b/pkg/serializer/serializer_test.go
index e4efa6719..94e8fc445 100644
--- a/pkg/serializer/serializer_test.go
+++ b/pkg/serializer/serializer_test.go
@@ -18,7 +18,7 @@ func TestSerializer(t *testing.T) {
B: true,
S: "a\x09b",
T: T1,
- I: []interface{}{
+ I: []any{
nil,
Y{V: 42},
new(Y),
@@ -71,7 +71,7 @@ type X struct {
B bool
S string
T T
- I []interface{}
+ I []any
F func()
}
diff --git a/pkg/signal/signal.go b/pkg/signal/signal.go
index 506d65aac..da3aca538 100644
--- a/pkg/signal/signal.go
+++ b/pkg/signal/signal.go
@@ -101,10 +101,10 @@ func (s Signal) ToRaw() []uint64 {
type Context struct {
Signal Signal
- Context interface{}
+ Context any
}
-func Minimize(corpus []Context) []interface{} {
+func Minimize(corpus []Context) []any {
type ContextPrio struct {
prio prioType
idx int
@@ -124,7 +124,7 @@ func Minimize(corpus []Context) []interface{} {
for _, cp := range covered {
indices[cp.idx] = struct{}{}
}
- result := make([]interface{}, 0, len(indices))
+ result := make([]any, 0, len(indices))
for idx := range indices {
result = append(result, corpus[idx].Context)
}
diff --git a/pkg/subsystem/linux/maintainers.go b/pkg/subsystem/linux/maintainers.go
index d1d65400d..00aedda0e 100644
--- a/pkg/subsystem/linux/maintainers.go
+++ b/pkg/subsystem/linux/maintainers.go
@@ -83,7 +83,7 @@ type endOfFile struct{}
var propertyRe = regexp.MustCompile(`^([[:alpha:]]):\s+(.*).*$`)
-func (ml *maintainersLexer) next() interface{} {
+func (ml *maintainersLexer) next() any {
for ml.scanner.Scan() {
ml.currentLine++
rawLine := ml.scanner.Text()
diff --git a/pkg/tool/tool.go b/pkg/tool/tool.go
index 0221cb876..d67949355 100644
--- a/pkg/tool/tool.go
+++ b/pkg/tool/tool.go
@@ -25,7 +25,7 @@ func Init() func() {
return installProfiling(*flagCPUProfile, *flagMEMProfile)
}
-func Failf(msg string, args ...interface{}) {
+func Failf(msg string, args ...any) {
fmt.Fprintf(os.Stderr, msg+"\n", args...)
os.Exit(1)
}
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)
diff --git a/sys/syz-extract/extract.go b/sys/syz-extract/extract.go
index aa020b029..db0274df1 100644
--- a/sys/syz-extract/extract.go
+++ b/sys/syz-extract/extract.go
@@ -95,7 +95,7 @@ func main() {
tool.Fail(err)
}
- jobC := make(chan interface{}, len(arches)+nfiles)
+ jobC := make(chan any, len(arches)+nfiles)
for _, arch := range arches {
jobC <- arch
}
@@ -152,7 +152,7 @@ func main() {
}
}
-func worker(extractor Extractor, jobC chan interface{}) {
+func worker(extractor Extractor, jobC chan any) {
for job := range jobC {
switch j := job.(type) {
case *Arch:
diff --git a/syz-ci/jobs.go b/syz-ci/jobs.go
index ee2e861b3..ed24ab421 100644
--- a/syz-ci/jobs.go
+++ b/syz-ci/jobs.go
@@ -798,12 +798,12 @@ func aggregateTestResults(results []instance.EnvTestResult) (*patchTestResult, e
return nil, anyErr
}
-func (jp *JobProcessor) Logf(level int, msg string, args ...interface{}) {
- log.Logf(level, "%s: "+msg, append([]interface{}{jp.name}, args...)...)
+func (jp *JobProcessor) Logf(level int, msg string, args ...any) {
+ log.Logf(level, "%s: "+msg, append([]any{jp.name}, args...)...)
}
// Errorf logs non-fatal error and sends it to dashboard.
-func (jp *JobProcessor) Errorf(msg string, args ...interface{}) {
+func (jp *JobProcessor) Errorf(msg string, args ...any) {
log.Errorf("job: "+msg, args...)
if jp.dash != nil {
jp.dash.LogError(jp.name, msg, args...)
diff --git a/syz-ci/manager.go b/syz-ci/manager.go
index 116b605f0..605ddf05f 100644
--- a/syz-ci/manager.go
+++ b/syz-ci/manager.go
@@ -100,7 +100,7 @@ type ManagerDashapi interface {
ReportBuildError(req *dashapi.BuildErrorReq) error
UploadBuild(build *dashapi.Build) error
BuilderPoll(manager string) (*dashapi.BuilderPollResp, error)
- LogError(name, msg string, args ...interface{})
+ LogError(name, msg string, args ...any)
CommitPoll() (*dashapi.CommitPollResp, error)
UploadCommits(commits []dashapi.Commit) error
}
@@ -1082,7 +1082,7 @@ func uploadFileHTTPPut(ctx context.Context, URL string, file io.Reader) error {
}
// Errorf logs non-fatal error and sends it to dashboard.
-func (mgr *Manager) Errorf(msg string, args ...interface{}) {
+func (mgr *Manager) Errorf(msg string, args ...any) {
for _, arg := range args {
err, _ := arg.(error)
if err == nil {
diff --git a/syz-ci/manager_test.go b/syz-ci/manager_test.go
index e9ca7071d..5b37de2ec 100644
--- a/syz-ci/manager_test.go
+++ b/syz-ci/manager_test.go
@@ -37,7 +37,7 @@ func (dm *dashapiMock) BuilderPoll(manager string) (*dashapi.BuilderPollResp, er
// We don't care about the methods below for now.
func (dm *dashapiMock) ReportBuildError(req *dashapi.BuildErrorReq) error { return nil }
func (dm *dashapiMock) UploadBuild(build *dashapi.Build) error { return nil }
-func (dm *dashapiMock) LogError(name, msg string, args ...interface{}) {}
+func (dm *dashapiMock) LogError(name, msg string, args ...any) {}
func (dm *dashapiMock) CommitPoll() (*dashapi.CommitPollResp, error) { return nil, nil }
func (dm *dashapiMock) UploadCommits(commits []dashapi.Commit) error { return nil }
diff --git a/syz-ci/managercmd.go b/syz-ci/managercmd.go
index 8156282b5..785739c7f 100644
--- a/syz-ci/managercmd.go
+++ b/syz-ci/managercmd.go
@@ -26,7 +26,7 @@ type ManagerCmd struct {
closing chan bool
}
-type Errorf func(msg string, args ...interface{})
+type Errorf func(msg string, args ...any)
// NewManagerCmd starts new syz-manager process.
// name - name for logging.
diff --git a/syz-cluster/pkg/app/logging.go b/syz-cluster/pkg/app/logging.go
index a4202dd84..01bd4bd3f 100644
--- a/syz-cluster/pkg/app/logging.go
+++ b/syz-cluster/pkg/app/logging.go
@@ -7,10 +7,10 @@ import "log"
// TODO: catch these with monitoring.
-func Errorf(fmt string, args ...interface{}) {
+func Errorf(fmt string, args ...any) {
log.Printf(fmt, args...)
}
-func Fatalf(fmt string, args ...interface{}) {
+func Fatalf(fmt string, args ...any) {
log.Fatalf(fmt, args...)
}
diff --git a/syz-cluster/pkg/controller/api.go b/syz-cluster/pkg/controller/api.go
index 7520a05f9..6aad3ff42 100644
--- a/syz-cluster/pkg/controller/api.go
+++ b/syz-cluster/pkg/controller/api.go
@@ -78,7 +78,7 @@ func (c APIServer) triageResult(w http.ResponseWriter, r *http.Request) {
http.Error(w, fmt.Sprint(err), http.StatusInternalServerError)
return
}
- api.ReplyJSON[interface{}](w, nil)
+ api.ReplyJSON[any](w, nil)
}
func (c APIServer) getSeries(w http.ResponseWriter, r *http.Request) {
@@ -118,7 +118,7 @@ func (c APIServer) uploadTest(w http.ResponseWriter, r *http.Request) {
http.Error(w, fmt.Sprint(err), http.StatusInternalServerError)
return
}
- api.ReplyJSON[interface{}](w, nil)
+ api.ReplyJSON[any](w, nil)
}
func (c APIServer) uploadTestArtifact(w http.ResponseWriter, r *http.Request) {
@@ -148,7 +148,7 @@ func (c APIServer) uploadTestArtifact(w http.ResponseWriter, r *http.Request) {
http.Error(w, fmt.Sprint(err), http.StatusInternalServerError)
return
}
- api.ReplyJSON[interface{}](w, nil)
+ api.ReplyJSON[any](w, nil)
}
func (c APIServer) uploadFinding(w http.ResponseWriter, r *http.Request) {
@@ -162,7 +162,7 @@ func (c APIServer) uploadFinding(w http.ResponseWriter, r *http.Request) {
http.Error(w, fmt.Sprint(err), http.StatusInternalServerError)
return
}
- api.ReplyJSON[interface{}](w, nil)
+ api.ReplyJSON[any](w, nil)
}
func (c APIServer) getLastBuild(w http.ResponseWriter, r *http.Request) {
@@ -224,7 +224,7 @@ func (c APIServer) uploadBaseFinding(w http.ResponseWriter, r *http.Request) {
http.Error(w, fmt.Sprint(err), http.StatusInternalServerError)
return
}
- api.ReplyJSON[interface{}](w, nil)
+ api.ReplyJSON[any](w, nil)
}
func (c APIServer) baseFindingStatus(w http.ResponseWriter, r *http.Request) {
diff --git a/syz-cluster/pkg/db/base_finding_repo.go b/syz-cluster/pkg/db/base_finding_repo.go
index e963cb691..9ba5df92a 100644
--- a/syz-cluster/pkg/db/base_finding_repo.go
+++ b/syz-cluster/pkg/db/base_finding_repo.go
@@ -38,7 +38,7 @@ CommitHash = @commit AND
Config = @config AND
Arch = @arch AND
Title = @title`,
- Params: map[string]interface{}{
+ Params: map[string]any{
"commit": info.CommitHash,
"config": info.Config,
"arch": info.Arch,
diff --git a/syz-cluster/pkg/db/build_repo.go b/syz-cluster/pkg/db/build_repo.go
index 6ce088a96..8e18388af 100644
--- a/syz-cluster/pkg/db/build_repo.go
+++ b/syz-cluster/pkg/db/build_repo.go
@@ -44,7 +44,7 @@ type LastBuildParams struct {
func (repo *BuildRepository) LastBuiltTree(ctx context.Context, params *LastBuildParams) (*Build, error) {
stmt := spanner.Statement{
SQL: "SELECT * FROM `Builds` WHERE 1=1",
- Params: map[string]interface{}{},
+ Params: map[string]any{},
}
if params.Arch != "" {
stmt.SQL += " AND `Arch` = @arch"
diff --git a/syz-cluster/pkg/db/finding_repo.go b/syz-cluster/pkg/db/finding_repo.go
index 0c9e1e0b9..afcc559b1 100644
--- a/syz-cluster/pkg/db/finding_repo.go
+++ b/syz-cluster/pkg/db/finding_repo.go
@@ -44,7 +44,7 @@ func (repo *FindingRepository) Store(ctx context.Context, id *FindingID,
oldFinding, err := readEntity[Finding](ctx, txn, spanner.Statement{
SQL: "SELECT * from `Findings` WHERE `SessionID`=@sessionID " +
"AND `TestName` = @testName AND `Title`=@title",
- Params: map[string]interface{}{
+ Params: map[string]any{
"sessionID": id.SessionID,
"testName": id.TestName,
"title": id.Title,
@@ -56,7 +56,7 @@ func (repo *FindingRepository) Store(ctx context.Context, id *FindingID,
// Query the Session object.
session, err := readEntity[Session](ctx, txn, spanner.Statement{
SQL: "SELECT * FROM `Sessions` WHERE `ID`=@id",
- Params: map[string]interface{}{"id": id.SessionID},
+ Params: map[string]any{"id": id.SessionID},
})
if err != nil {
return err
@@ -105,7 +105,7 @@ func (repo *FindingRepository) mustStore(ctx context.Context, finding *Finding)
func (repo *FindingRepository) ListForSession(ctx context.Context, sessionID string, limit int) ([]*Finding, error) {
stmt := spanner.Statement{
SQL: "SELECT * FROM `Findings` WHERE `SessionID` = @session ORDER BY `TestName`, `Title`",
- Params: map[string]interface{}{"session": sessionID},
+ Params: map[string]any{"session": sessionID},
}
addLimit(&stmt, limit)
return repo.readEntities(ctx, stmt)
diff --git a/syz-cluster/pkg/db/report_reply_repo.go b/syz-cluster/pkg/db/report_reply_repo.go
index e20bd6e7a..5c76b5f17 100644
--- a/syz-cluster/pkg/db/report_reply_repo.go
+++ b/syz-cluster/pkg/db/report_reply_repo.go
@@ -29,7 +29,7 @@ func (repo *ReportReplyRepository) FindParentReportID(ctx context.Context, repor
"JOIN `SessionReports` ON `SessionReports`.ID = `ReportReplies`.ReportID " +
"WHERE `ReportReplies`.MessageID = @messageID " +
"AND `SessionReports`.Reporter = @reporter LIMIT 1",
- Params: map[string]interface{}{
+ Params: map[string]any{
"reporter": reporter,
"messageID": messageID,
},
@@ -50,7 +50,7 @@ func (repo *ReportReplyRepository) Insert(ctx context.Context, reply *ReportRepl
entity, err := readEntity[ReportReply](ctx, txn, spanner.Statement{
SQL: "SELECT * from `ReportReplies` " +
"WHERE `ReportID`=@reportID AND `MessageID`=@messageID",
- Params: map[string]interface{}{
+ Params: map[string]any{
"reportID": reply.ReportID,
"messageID": reply.MessageID,
},
@@ -75,7 +75,7 @@ func (repo *ReportReplyRepository) LastForReporter(ctx context.Context, reporter
"JOIN `SessionReports` ON `SessionReports`.ID=`ReportReplies`.ReportID " +
"WHERE `SessionReports`.Reporter=@reporter " +
"ORDER BY `Time` DESC LIMIT 1",
- Params: map[string]interface{}{
+ Params: map[string]any{
"reporter": reporter,
},
})
diff --git a/syz-cluster/pkg/db/report_repo.go b/syz-cluster/pkg/db/report_repo.go
index 6e9f469f8..28ca3a89a 100644
--- a/syz-cluster/pkg/db/report_repo.go
+++ b/syz-cluster/pkg/db/report_repo.go
@@ -55,7 +55,7 @@ func (repo *ReportRepository) ListNotReported(ctx context.Context, reporter stri
limit int) ([]*SessionReport, error) {
stmt := spanner.Statement{
SQL: "SELECT * FROM `SessionReports` WHERE `Reporter` = @reporter AND `ReportedAt` IS NULL",
- Params: map[string]interface{}{
+ Params: map[string]any{
"reporter": reporter,
},
}
diff --git a/syz-cluster/pkg/db/series_repo.go b/syz-cluster/pkg/db/series_repo.go
index 0ac32415d..bb8bf7a8d 100644
--- a/syz-cluster/pkg/db/series_repo.go
+++ b/syz-cluster/pkg/db/series_repo.go
@@ -38,7 +38,7 @@ func NewSeriesRepository(client *spanner.Client) *SeriesRepository {
func (repo *SeriesRepository) PatchByID(ctx context.Context, id string) (*Patch, error) {
return readEntity[Patch](ctx, repo.client.Single(), spanner.Statement{
SQL: "SELECT * FROM Patches WHERE ID=@id",
- Params: map[string]interface{}{"id": id},
+ Params: map[string]any{"id": id},
})
}
@@ -46,7 +46,7 @@ func (repo *SeriesRepository) PatchByID(ctx context.Context, id string) (*Patch,
func (repo *SeriesRepository) GetByExtID(ctx context.Context, extID string) (*Series, error) {
return readEntity[Series](ctx, repo.client.Single(), spanner.Statement{
SQL: "SELECT * FROM Series WHERE ExtID=@extID",
- Params: map[string]interface{}{"extID": extID},
+ Params: map[string]any{"extID": extID},
})
}
@@ -74,7 +74,7 @@ func (repo *SeriesRepository) Insert(ctx context.Context, series *Series,
// Check if the series already exists.
stmt := spanner.Statement{
SQL: "SELECT 1 from `Series` WHERE `ExtID`=@extID",
- Params: map[string]interface{}{"ExtID": series.ExtID},
+ Params: map[string]any{"ExtID": series.ExtID},
}
iter := txn.Query(ctx, stmt)
defer iter.Stop()
@@ -142,7 +142,7 @@ func (repo *SeriesRepository) ListLatest(ctx context.Context, filter SeriesFilte
stmt := spanner.Statement{
SQL: "SELECT Series.* FROM Series WHERE 1=1",
- Params: map[string]interface{}{},
+ Params: map[string]any{},
}
if !maxPublishedAt.IsZero() {
stmt.SQL += " AND PublishedAt < @toTime"
@@ -226,7 +226,7 @@ func (repo *SeriesRepository) querySessions(ctx context.Context, ro *spanner.Rea
}
sessions, err := readEntities[Session](ctx, ro, spanner.Statement{
SQL: "SELECT * FROM Sessions WHERE ID IN UNNEST(@ids)",
- Params: map[string]interface{}{
+ Params: map[string]any{
"ids": keys,
},
})
@@ -265,7 +265,7 @@ func (repo *SeriesRepository) queryFindingCounts(ctx context.Context, ro *spanne
SQL: "SELECT `SessionID`, COUNT(`ID`) as `Count` FROM `Findings` " +
"WHERE `SessionID` IN UNNEST(@ids) AND `Findings`.`InvalidatedAt` IS NULL " +
"GROUP BY `SessionID`",
- Params: map[string]interface{}{
+ Params: map[string]any{
"ids": keys,
},
})
@@ -283,7 +283,7 @@ func (repo *SeriesRepository) queryFindingCounts(ctx context.Context, ro *spanne
func (repo *SeriesRepository) ListPatches(ctx context.Context, series *Series) ([]*Patch, error) {
return readEntities[Patch](ctx, repo.client.Single(), spanner.Statement{
SQL: "SELECT * FROM `Patches` WHERE `SeriesID` = @seriesID ORDER BY `Seq`",
- Params: map[string]interface{}{
+ Params: map[string]any{
"seriesID": series.ID,
},
})
diff --git a/syz-cluster/pkg/db/session_repo.go b/syz-cluster/pkg/db/session_repo.go
index 3db95092b..583a5f4af 100644
--- a/syz-cluster/pkg/db/session_repo.go
+++ b/syz-cluster/pkg/db/session_repo.go
@@ -35,7 +35,7 @@ func (repo *SessionRepository) Start(ctx context.Context, sessionID string) erro
func(ctx context.Context, txn *spanner.ReadWriteTransaction) error {
session, err := readEntity[Session](ctx, txn, spanner.Statement{
SQL: "SELECT * from `Sessions` WHERE `ID`=@id",
- Params: map[string]interface{}{"id": sessionID},
+ Params: map[string]any{"id": sessionID},
})
if err != nil {
return err
@@ -50,7 +50,7 @@ func (repo *SessionRepository) Start(ctx context.Context, sessionID string) erro
}
series, err := readEntity[Series](ctx, txn, spanner.Statement{
SQL: "SELECT * from `Series` WHERE `ID`=@id",
- Params: map[string]interface{}{"id": session.SeriesID},
+ Params: map[string]any{"id": session.SeriesID},
})
if err != nil {
return err
@@ -87,7 +87,7 @@ func (repo *SessionRepository) ListWaiting(ctx context.Context, from *NextSessio
limit int) ([]*Session, *NextSession, error) {
stmt := spanner.Statement{
SQL: "SELECT * FROM `Sessions` WHERE `StartedAt` IS NULL",
- Params: map[string]interface{}{},
+ Params: map[string]any{},
}
if from != nil {
stmt.SQL += " AND ((`CreatedAt` > @from) OR (`CreatedAt` = @from AND `ID` > @id))"
@@ -114,7 +114,7 @@ func (repo *SessionRepository) ListWaiting(ctx context.Context, from *NextSessio
func (repo *SessionRepository) ListForSeries(ctx context.Context, series *Series) ([]*Session, error) {
return repo.readEntities(ctx, spanner.Statement{
SQL: "SELECT * FROM `Sessions` WHERE `SeriesID` = @series ORDER BY CreatedAt DESC",
- Params: map[string]interface{}{"series": series.ID},
+ Params: map[string]any{"series": series.ID},
})
}
@@ -129,7 +129,7 @@ func (repo *SessionRepository) MissingReportList(ctx context.Context, from time.
"SELECT 1 FROM SessionReports WHERE SessionReports.SessionID = Sessions.ID" +
") AND EXISTS (" +
"SELECT 1 FROM Findings WHERE Findings.SessionID = Sessions.ID)",
- Params: map[string]interface{}{},
+ Params: map[string]any{},
}
if !from.IsZero() {
stmt.SQL += " AND `FinishedAt` > @from"
diff --git a/syz-cluster/pkg/db/session_test_repo.go b/syz-cluster/pkg/db/session_test_repo.go
index 03316c38c..3454f11bb 100644
--- a/syz-cluster/pkg/db/session_test_repo.go
+++ b/syz-cluster/pkg/db/session_test_repo.go
@@ -27,7 +27,7 @@ func (repo *SessionTestRepository) InsertOrUpdate(ctx context.Context, test *Ses
// Check if the test already exists.
dbTest, err := readEntity[SessionTest](ctx, txn, spanner.Statement{
SQL: "SELECT * from `SessionTests` WHERE `SessionID`=@sessionID AND `TestName` = @testName",
- Params: map[string]interface{}{
+ Params: map[string]any{
"sessionID": test.SessionID,
"testName": test.TestName,
},
@@ -62,7 +62,7 @@ func (repo *SessionTestRepository) InsertOrUpdate(ctx context.Context, test *Ses
func (repo *SessionTestRepository) Get(ctx context.Context, sessionID, testName string) (*SessionTest, error) {
return readEntity[SessionTest](ctx, repo.client.Single(), spanner.Statement{
SQL: "SELECT * FROM `SessionTests` WHERE `SessionID` = @session AND `TestName` = @name",
- Params: map[string]interface{}{
+ Params: map[string]any{
"session": sessionID,
"name": testName,
},
@@ -99,7 +99,7 @@ func (repo *SessionTestRepository) BySession(ctx context.Context, sessionID stri
}
builds, err := readEntities[Build](ctx, repo.client.Single(), spanner.Statement{
SQL: "SELECT * FROM `Builds` WHERE `ID` IN UNNEST(@ids)",
- Params: map[string]interface{}{"ids": keys},
+ Params: map[string]any{"ids": keys},
})
if err != nil {
return nil, err
@@ -117,6 +117,6 @@ func (repo *SessionTestRepository) BySessionRaw(ctx context.Context, sessionID s
return readEntities[SessionTest](ctx, repo.client.Single(), spanner.Statement{
SQL: "SELECT * FROM `SessionTests` WHERE `SessionID` = @session" +
" ORDER BY `UpdatedAt`",
- Params: map[string]interface{}{"session": sessionID},
+ Params: map[string]any{"session": sessionID},
})
}
diff --git a/syz-cluster/pkg/db/spanner.go b/syz-cluster/pkg/db/spanner.go
index 659ff6c76..11933961a 100644
--- a/syz-cluster/pkg/db/spanner.go
+++ b/syz-cluster/pkg/db/spanner.go
@@ -305,7 +305,7 @@ type genericEntityOps[EntityType, KeyType any] struct {
func (g *genericEntityOps[EntityType, KeyType]) GetByID(ctx context.Context, key KeyType) (*EntityType, error) {
stmt := spanner.Statement{
SQL: "SELECT * FROM " + g.table + " WHERE " + g.keyField + "=@key",
- Params: map[string]interface{}{"key": key},
+ Params: map[string]any{"key": key},
}
return readEntity[EntityType](ctx, g.client.Single(), stmt)
}
@@ -318,7 +318,7 @@ func (g *genericEntityOps[EntityType, KeyType]) Update(ctx context.Context, key
func(ctx context.Context, txn *spanner.ReadWriteTransaction) error {
entity, err := readEntity[EntityType](ctx, txn, spanner.Statement{
SQL: "SELECT * from `" + g.table + "` WHERE `" + g.keyField + "`=@key",
- Params: map[string]interface{}{"key": key},
+ Params: map[string]any{"key": key},
})
if err != nil {
return err
diff --git a/syz-cluster/pkg/reporter/api.go b/syz-cluster/pkg/reporter/api.go
index 310dd57d1..192ea693d 100644
--- a/syz-cluster/pkg/reporter/api.go
+++ b/syz-cluster/pkg/reporter/api.go
@@ -46,13 +46,13 @@ func (s *APIServer) upstreamReport(w http.ResponseWriter, r *http.Request) {
}
// TODO: journal the action.
err := s.reportService.Upstream(r.Context(), r.PathValue("report_id"), req)
- reply[interface{}](w, nil, err)
+ reply[any](w, nil, err)
}
func (s *APIServer) invalidateReport(w http.ResponseWriter, r *http.Request) {
// TODO: journal the action.
err := s.reportService.Invalidate(r.Context(), r.PathValue("report_id"))
- reply[interface{}](w, nil, err)
+ reply[any](w, nil, err)
}
func (s *APIServer) nextReports(w http.ResponseWriter, r *http.Request) {
@@ -62,7 +62,7 @@ func (s *APIServer) nextReports(w http.ResponseWriter, r *http.Request) {
func (s *APIServer) confirmReport(w http.ResponseWriter, r *http.Request) {
err := s.reportService.Confirm(r.Context(), r.PathValue("report_id"))
- reply[interface{}](w, nil, err)
+ reply[any](w, nil, err)
}
func (s *APIServer) recordReply(w http.ResponseWriter, r *http.Request) {
diff --git a/syz-manager/manager.go b/syz-manager/manager.go
index 79f9e95d6..ed985c2fc 100644
--- a/syz-manager/manager.go
+++ b/syz-manager/manager.go
@@ -1175,7 +1175,7 @@ func (mgr *Manager) MachineChecked(features flatrpc.Feature,
EnabledCalls: enabledSyscalls,
NoMutateCalls: mgr.cfg.NoMutateCalls,
FetchRawCover: mgr.cfg.RawCover,
- Logf: func(level int, msg string, args ...interface{}) {
+ Logf: func(level int, msg string, args ...any) {
if level != 0 {
return
}
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)
}
diff --git a/vm/proxyapp/proxyappclient.go b/vm/proxyapp/proxyappclient.go
index 4ffa12b57..c3740ce6a 100644
--- a/vm/proxyapp/proxyappclient.go
+++ b/vm/proxyapp/proxyappclient.go
@@ -300,7 +300,7 @@ func (proxy *ProxyApp) signalLostConnection() {
}
}
-func (proxy *ProxyApp) Call(serviceMethod string, args, reply interface{}) error {
+func (proxy *ProxyApp) Call(serviceMethod string, args, reply any) error {
err := proxy.Client.Call(serviceMethod, args, reply)
if err == rpc.ErrShutdown {
proxy.signalLostConnection()
@@ -589,8 +589,8 @@ type stdInOutCloser struct {
io.Writer
}
-func clientErrorf(writer io.Writer) func(fmt string, s ...interface{}) {
- return func(f string, s ...interface{}) {
+func clientErrorf(writer io.Writer) func(fmt string, s ...any) {
+ return func(f string, s ...any) {
fmt.Fprintf(writer, f, s...)
writer.Write([]byte("\nSYZFAIL: proxy app plugin error\n"))
}
diff --git a/vm/qemu/qmp.go b/vm/qemu/qmp.go
index 4cd8d2de1..d24314893 100644
--- a/vm/qemu/qmp.go
+++ b/vm/qemu/qmp.go
@@ -29,8 +29,8 @@ type qmpBanner struct {
}
type qmpCommand struct {
- Execute string `json:"execute"`
- Arguments interface{} `json:"arguments,omitempty"`
+ Execute string `json:"execute"`
+ Arguments any `json:"arguments,omitempty"`
}
type hmpCommand struct {
@@ -43,10 +43,10 @@ type qmpResponse struct {
Class string
Desc string
}
- Return interface{}
+ Return any
Event string
- Data map[string]interface{}
+ Data map[string]any
Timestamp struct {
Seconds int64
Microseconds int64
@@ -102,7 +102,7 @@ func (inst *instance) doQmp(cmd *qmpCommand) (*qmpResponse, error) {
return inst.qmpRecv()
}
-func (inst *instance) qmp(cmd *qmpCommand) (interface{}, error) {
+func (inst *instance) qmp(cmd *qmpCommand) (any, error) {
if err := inst.qmpConnCheck(); err != nil {
return nil, err
}