From e6e35dba937599d098fc034eff2686e5ddc409e9 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 26 Oct 2020 10:51:06 +0100 Subject: sys/targets: add OS/Arch name consts We use strings to identify OS/Arch. These strings are duplicated throughout the code base massively. golangci-lint points to possiblity of typos and duplication. We already had to define these names in pkg/csource and disable checking for prog package. A future change triggers such warnings in another package. Add OS/Arch name consts to sys/targets so that they can be used to refer to OS/Arch. Use the consts everywhere. --- dashboard/app/api.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'dashboard/app/api.go') diff --git a/dashboard/app/api.go b/dashboard/app/api.go index 73a802d61..f802603d8 100644 --- a/dashboard/app/api.go +++ b/dashboard/app/api.go @@ -19,6 +19,7 @@ import ( "github.com/google/syzkaller/dashboard/dashapi" "github.com/google/syzkaller/pkg/email" "github.com/google/syzkaller/pkg/hash" + "github.com/google/syzkaller/sys/targets" "golang.org/x/net/context" "google.golang.org/appengine" db "google.golang.org/appengine/datastore" @@ -784,7 +785,7 @@ func saveCrash(c context.Context, ns string, req *dashapi.Crash, bugKey *db.Key, } else if len(req.ReproSyz) != 0 { prio += 2e12 } - if build.Arch == "amd64" { + if build.Arch == targets.AMD64 { prio += 1e3 } crash := &Crash{ -- cgit mrf-deployment