Skip to content

Commit 6cab97f

Browse files
committed
style: use tagged switches and drop unused test assignments
Use tagged switches where staticcheck suggests them and drop two test assignments whose values are never read. Behaviour is unchanged. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent 456ea6b commit 6cab97f

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎cmd/backport-batch/effects_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func emptyBatch(f *fixture, gh *fakeGH, body string) *foldWorld {
5353
// and every check of the batch's shape takes the old name as the same file:
5454
// verify, a hand fold, and a rebuild by --defer.
5555
func TestRenamePickThroughFoldAndVerify(t *testing.T) {
56-
f, mc5 := renameWorld(t)
56+
f, _ := renameWorld(t)
5757
f.pr(6, "fix(app): six", "", map[string]string{"app/six.txt": "6\n"})
5858
gh := &fakeGH{}
5959
head := openBatch(t, f, gh)
@@ -74,7 +74,7 @@ func TestRenamePickThroughFoldAndVerify(t *testing.T) {
7474
t.Errorf("verify after the rebuild = %d\n%s\n%s", code, out, stderr)
7575
}
7676

77-
f, mc5 = renameWorld(t)
77+
f, mc5 := renameWorld(t)
7878
w := emptyBatch(f, &fakeGH{}, "")
7979
pick := w.pick(w.head, f.git("rev-parse", mc5+"^2"), map[string]string{"app/old.txt": strings.Replace(appFile, "three", "THREE", 1)})
8080
fold := w.merge(w.head, pick, "fix(app): fix the app file (#5)\n\n"+batchTrailer+": "+mc5)

‎cmd/backport-batch/notify.go‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ func (a *app) notify(args []string) int {
102102
var conflicts, waiting []int
103103
after := map[int][]int{}
104104
for n, e := range deferred {
105-
switch place := placement(deferred, n, map[int]bool{}); {
106-
case place == "workflow":
105+
switch placement(deferred, n, map[int]bool{}) {
106+
case "workflow":
107107
waiting = append(waiting, n)
108-
case place == "conflict":
108+
case "conflict":
109109
conflicts = append(conflicts, n)
110110
}
111111
if len(e.Needs) > 0 {
@@ -259,10 +259,10 @@ func placement(deferred map[int]deferredEntry, n int, seen map[int]bool) string
259259
seen[n] = true
260260
place := ""
261261
for _, f := range e.Needs {
262-
switch p := placement(deferred, f, seen); {
263-
case p == "workflow":
262+
switch p := placement(deferred, f, seen); p {
263+
case "workflow":
264264
return p
265-
case p == "conflict":
265+
case "conflict":
266266
place = p
267267
}
268268
}

‎cmd/backport-batch/report.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,8 +780,8 @@ func (a *app) printReport(pr *pullRequest, s storedReport, inBody *storedReport,
780780
}
781781
for _, e := range d.Primary.Parked {
782782
text := "parked: "
783-
switch {
784-
case e.Kind == parkPartial:
783+
switch e.Kind {
784+
case parkPartial:
785785
text += "only part of it applies, it would leave " + strings.Join(e.Files, ", ") + " without effect"
786786
default:
787787
var needs []string

‎internal/backupcontroller/cnpgstrategy_controller_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2830,7 +2830,7 @@ func TestReconcileCNPG_ObjectStoreApplyRecovers(t *testing.T) {
28302830
}
28312831

28322832
failing = false
2833-
j, _ = f.pass()
2833+
_, _ = f.pass()
28342834
f.settleDestination()
28352835
j, backups := f.pass()
28362836
if len(backups) != 1 {

0 commit comments

Comments
 (0)