all: resolve go vet findings
Change-Id: I0e0b54abbeff5b71ee0870851e6ab21507a83e37
Reviewed-on: https://go-review.googlesource.com/c/build/+/643415
Reviewed-by: David Chase <drchase@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
diff --git a/cmd/relui/main.go b/cmd/relui/main.go
index 9cdb8dc..86ae224 100644
--- a/cmd/relui/main.go
+++ b/cmd/relui/main.go
@@ -216,7 +216,7 @@
log.Fatalln("pgxpool.Connect:", err)
}
defer dbPool.Close()
- dbPool = &relui.MetricsDB{dbPool}
+ dbPool = &relui.MetricsDB{PGDBTX: dbPool}
var gr *metrics.MonitoredResource
if metadata.OnGCE() {
diff --git a/internal/coordinator/pool/ledger_test.go b/internal/coordinator/pool/ledger_test.go
index 714b6b1..4dfa164 100644
--- a/internal/coordinator/pool/ledger_test.go
+++ b/internal/coordinator/pool/ledger_test.go
@@ -359,7 +359,7 @@
types []*cloud.InstanceType
}{
{"no-type", []*cloud.InstanceType{}},
- {"single-type", []*cloud.InstanceType{{"x", 15}}},
+ {"single-type", []*cloud.InstanceType{{Type: "x", CPU: 15}}},
}
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
diff --git a/internal/gomote/swarming_test.go b/internal/gomote/swarming_test.go
index 1018f40..7e0c2ba 100644
--- a/internal/gomote/swarming_test.go
+++ b/internal/gomote/swarming_test.go
@@ -1137,7 +1137,8 @@
log.SetOutput(io.Discard)
defer log.SetOutput(os.Stdout)
- ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
+ ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
+ defer cancel()
rdv := rendezvous.New(ctx, rendezvous.OptionValidator(func(ctx context.Context, jwt string) bool {
return true
}))
diff --git a/internal/relui/web_test.go b/internal/relui/web_test.go
index 845d89d..4ac63fc 100644
--- a/internal/relui/web_test.go
+++ b/internal/relui/web_test.go
@@ -889,7 +889,7 @@
t.Fatalf("FailUnfinishedTasks(_, %v) = _, %v, wanted no error", fail, err)
}
- params := httprouter.Params{{"id", wfID.String()}, {"name", "beep"}}
+ params := httprouter.Params{{Key: "id", Value: wfID.String()}, {Key: "name", Value: "beep"}}
req := httptest.NewRequest(http.MethodPost, path.Join("/workflows/", wfID.String(), "tasks", "beep", "retry"), nil)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req = req.WithContext(context.WithValue(req.Context(), "email", "test@google.com"))
@@ -930,7 +930,7 @@
t.Fatalf("CreateTask(_, %v) = _, %v, wanted no error", gtg, err)
}
- params := httprouter.Params{{"id", wfID.String()}, {"name", "approve"}}
+ params := httprouter.Params{{Key: "id", Value: wfID.String()}, {Key: "name", Value: "approve"}}
req := httptest.NewRequest(http.MethodPost, path.Join("/workflows/", wfID.String(), "tasks", "approve", "approve"), nil)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req = req.WithContext(context.WithValue(req.Context(), "email", "test@google.com"))
@@ -962,7 +962,7 @@
}
s.w.markRunning(&workflow.Workflow{ID: wfID}, func() {})
- params := httprouter.Params{{"id", wfID.String()}}
+ params := httprouter.Params{{Key: "id", Value: wfID.String()}}
req := httptest.NewRequest(http.MethodPost, path.Join("/workflows/", wfID.String(), "stop"), nil)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req = req.WithContext(context.WithValue(req.Context(), "email", "test@google.com"))
@@ -986,7 +986,7 @@
t.Fatalf("Scheduler.Create() = _, %v, wanted no error", err)
}
- params := httprouter.Params{{"id", strconv.Itoa(int(sched.ID))}}
+ params := httprouter.Params{{Key: "id", Value: strconv.Itoa(int(sched.ID))}}
req := httptest.NewRequest(http.MethodPost, path.Join("/schedules/", strconv.Itoa(int(sched.ID)), "delete"), nil)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req = req.WithContext(context.WithValue(req.Context(), "email", "test@google.com"))