Skip to content

Commit 6a93df3

Browse files
alirezaarzehgargopherbot
authored andcommitted
all: resolve go vet findings
Change-Id: I0e0b54abbeff5b71ee0870851e6ab21507a83e37 Reviewed-on: https://go-review.googlesource.com/c/build/+/643415 Reviewed-by: David Chase <[email protected]> TryBot-Bypass: Dmitri Shuralyov <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 6f3593c commit 6a93df3

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

cmd/relui/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func main() {
216216
log.Fatalln("pgxpool.Connect:", err)
217217
}
218218
defer dbPool.Close()
219-
dbPool = &relui.MetricsDB{dbPool}
219+
dbPool = &relui.MetricsDB{PGDBTX: dbPool}
220220

221221
var gr *metrics.MonitoredResource
222222
if metadata.OnGCE() {

internal/coordinator/pool/ledger_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ func TestLedgerUpdateInstanceTypes(t *testing.T) {
359359
types []*cloud.InstanceType
360360
}{
361361
{"no-type", []*cloud.InstanceType{}},
362-
{"single-type", []*cloud.InstanceType{{"x", 15}}},
362+
{"single-type", []*cloud.InstanceType{{Type: "x", CPU: 15}}},
363363
}
364364
for _, tc := range testCases {
365365
t.Run(tc.desc, func(t *testing.T) {

internal/gomote/swarming_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,8 @@ func TestStartNewSwarmingTask(t *testing.T) {
11371137
log.SetOutput(io.Discard)
11381138
defer log.SetOutput(os.Stdout)
11391139

1140-
ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
1140+
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
1141+
defer cancel()
11411142
rdv := rendezvous.New(ctx, rendezvous.OptionValidator(func(ctx context.Context, jwt string) bool {
11421143
return true
11431144
}))

internal/relui/web_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ func testWorkflowACL(t *testing.T, acld bool, authorized bool, wantSucceed bool)
889889
t.Fatalf("FailUnfinishedTasks(_, %v) = _, %v, wanted no error", fail, err)
890890
}
891891

892-
params := httprouter.Params{{"id", wfID.String()}, {"name", "beep"}}
892+
params := httprouter.Params{{Key: "id", Value: wfID.String()}, {Key: "name", Value: "beep"}}
893893
req := httptest.NewRequest(http.MethodPost, path.Join("/workflows/", wfID.String(), "tasks", "beep", "retry"), nil)
894894
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
895895
req = req.WithContext(context.WithValue(req.Context(), "email", "[email protected]"))
@@ -930,7 +930,7 @@ func testWorkflowACL(t *testing.T, acld bool, authorized bool, wantSucceed bool)
930930
t.Fatalf("CreateTask(_, %v) = _, %v, wanted no error", gtg, err)
931931
}
932932

933-
params := httprouter.Params{{"id", wfID.String()}, {"name", "approve"}}
933+
params := httprouter.Params{{Key: "id", Value: wfID.String()}, {Key: "name", Value: "approve"}}
934934
req := httptest.NewRequest(http.MethodPost, path.Join("/workflows/", wfID.String(), "tasks", "approve", "approve"), nil)
935935
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
936936
req = req.WithContext(context.WithValue(req.Context(), "email", "[email protected]"))
@@ -962,7 +962,7 @@ func testWorkflowACL(t *testing.T, acld bool, authorized bool, wantSucceed bool)
962962
}
963963
s.w.markRunning(&workflow.Workflow{ID: wfID}, func() {})
964964

965-
params := httprouter.Params{{"id", wfID.String()}}
965+
params := httprouter.Params{{Key: "id", Value: wfID.String()}}
966966
req := httptest.NewRequest(http.MethodPost, path.Join("/workflows/", wfID.String(), "stop"), nil)
967967
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
968968
req = req.WithContext(context.WithValue(req.Context(), "email", "[email protected]"))
@@ -986,7 +986,7 @@ func testWorkflowACL(t *testing.T, acld bool, authorized bool, wantSucceed bool)
986986
t.Fatalf("Scheduler.Create() = _, %v, wanted no error", err)
987987
}
988988

989-
params := httprouter.Params{{"id", strconv.Itoa(int(sched.ID))}}
989+
params := httprouter.Params{{Key: "id", Value: strconv.Itoa(int(sched.ID))}}
990990
req := httptest.NewRequest(http.MethodPost, path.Join("/schedules/", strconv.Itoa(int(sched.ID)), "delete"), nil)
991991
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
992992
req = req.WithContext(context.WithValue(req.Context(), "email", "[email protected]"))

0 commit comments

Comments
 (0)