aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard/app
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2025-07-15 16:43:33 +0200
committerTaras Madan <tarasmadan@google.com>2025-07-17 08:31:25 +0000
commitabd11cfd08430ec5f9d2c6dbd0e0f798816922d1 (patch)
tree522a8cc072d07d85c8a1d37b5b3ab89483599b48 /dashboard/app
parenta81f309b57265e5760b926274e1f1681e7550e41 (diff)
all: apply linter auto fixes
./tools/syz-env bin/golangci-lint run ./... --fix
Diffstat (limited to 'dashboard/app')
-rw-r--r--dashboard/app/jobs.go5
-rw-r--r--dashboard/app/kcidb.go9
-rw-r--r--dashboard/app/main.go6
-rw-r--r--dashboard/app/reporting.go5
-rw-r--r--dashboard/app/util_test.go5
5 files changed, 14 insertions, 16 deletions
diff --git a/dashboard/app/jobs.go b/dashboard/app/jobs.go
index f5f629d81..b7ff881a3 100644
--- a/dashboard/app/jobs.go
+++ b/dashboard/app/jobs.go
@@ -940,10 +940,11 @@ func handleRetestedRepro(c context.Context, now time.Time, job *Job, jobKey *db.
crash.LastReproRetest = now
if req.Error == nil && !crash.ReproIsRevoked {
// If repro testing itself failed, it might be just a temporary issue.
- if job.Type == JobTestPatch {
+ switch job.Type {
+ case JobTestPatch:
// If there was any crash at all, the repro is still not worth discarding.
crash.ReproIsRevoked = len(allTitles) == 0
- } else if job.Type == JobBisectFix {
+ case JobBisectFix:
// More than one commit is suspected => repro stopped working at some point.
crash.ReproIsRevoked = len(req.Commits) > 0
}
diff --git a/dashboard/app/kcidb.go b/dashboard/app/kcidb.go
index 6fe641276..7203c6dfa 100644
--- a/dashboard/app/kcidb.go
+++ b/dashboard/app/kcidb.go
@@ -69,13 +69,8 @@ func publishKcidbBug(c context.Context, client *kcidb.Client, bug *Bug, bugKey *
if err != nil {
return false, err
}
- publish := true
- if rep.KernelCommit == "" || len(rep.KernelConfig) == 0 {
- // This should happen only for syzkaller build/test errors, which we don't want to publish.
- // But if this ever happens for a kernel bug, then we also don't want to publish such bugs
- // with missing critical info.
- publish = false
- }
+ publish := !(rep.KernelCommit == "" || len(rep.KernelConfig) == 0)
+
if publish {
if err := client.Publish(rep); err != nil {
return false, err
diff --git a/dashboard/app/main.go b/dashboard/app/main.go
index 78aed619f..eeba85c9e 100644
--- a/dashboard/app/main.go
+++ b/dashboard/app/main.go
@@ -1315,7 +1315,7 @@ func debugBugSubsystems(c context.Context, w http.ResponseWriter, bug *Bug) erro
TraceWriter: w,
})
if err != nil {
- w.Write([]byte(fmt.Sprintf("%s", err)))
+ fmt.Fprintf(w, "%s", err)
}
return nil
}
@@ -2407,8 +2407,8 @@ func invalidateJobLink(c context.Context, job *Job, jobKey *db.Key, restart bool
func formatLogLine(line string) string {
const maxLineLen = 1000
- line = strings.Replace(line, "\n", " ", -1)
- line = strings.Replace(line, "\r", "", -1)
+ line = strings.ReplaceAll(line, "\n", " ")
+ line = strings.ReplaceAll(line, "\r", "")
if len(line) > maxLineLen {
line = line[:maxLineLen]
line += "..."
diff --git a/dashboard/app/reporting.go b/dashboard/app/reporting.go
index b73bab8ac..c5e6ff1e3 100644
--- a/dashboard/app/reporting.go
+++ b/dashboard/app/reporting.go
@@ -1288,11 +1288,12 @@ func findCrashForBug(c context.Context, bug *Bug) (*Crash, *db.Key, error) {
return nil, nil, fmt.Errorf("no crashes")
}
crash, key := crashes[0], keys[0]
- if bug.HeadReproLevel == ReproLevelC {
+ switch bug.HeadReproLevel {
+ case ReproLevelC:
if crash.ReproC == 0 {
log.Errorf(c, "bug '%v': has C repro, but crash without C repro", bug.Title)
}
- } else if bug.HeadReproLevel == ReproLevelSyz {
+ case ReproLevelSyz:
if crash.ReproSyz == 0 {
log.Errorf(c, "bug '%v': has syz repro, but crash without syz repro", bug.Title)
}
diff --git a/dashboard/app/util_test.go b/dashboard/app/util_test.go
index f9e2ad660..2040f879e 100644
--- a/dashboard/app/util_test.go
+++ b/dashboard/app/util_test.go
@@ -357,9 +357,10 @@ func (c *Ctx) httpRequest(method, url, body, contentType string,
}
r = registerRequest(r, c)
r = r.WithContext(c.transformContext(r.Context()))
- if access == AccessAdmin {
+ switch access {
+ case AccessAdmin:
aetest.Login(makeUser(AuthorizedAdmin), r)
- } else if access == AccessUser {
+ case AccessUser:
aetest.Login(makeUser(AuthorizedUser), r)
}
w := httptest.NewRecorder()