cli/manifest: remove redundant capturing of loop vars in tests (copyloopvar)

go1.22 and up now produce a unique variable in loops, tehrefore no longer
requiring to capture the variable manually;

    service/logs/parse_logs_test.go:50:3: The copy of the 'for' variable "tc" can be deleted (Go 1.22+) (copyloopvar)
            tc := tc
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2024-11-05 09:59:54 +01:00
parent 6489a777e5
commit bf37e26b33
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 6 additions and 7 deletions

View File

@ -81,17 +81,16 @@ func TestStoreSaveAndGet(t *testing.T) {
}, },
} }
for _, testcase := range testcases { for _, tc := range testcases {
testcase := testcase t.Run(tc.manifestRef.String(), func(t *testing.T) {
t.Run(testcase.manifestRef.String(), func(t *testing.T) { actual, err := store.Get(tc.listRef, tc.manifestRef)
actual, err := store.Get(testcase.listRef, testcase.manifestRef) if tc.expectedErr != "" {
if testcase.expectedErr != "" { assert.Error(t, err, tc.expectedErr)
assert.Error(t, err, testcase.expectedErr)
assert.Check(t, IsNotFound(err)) assert.Check(t, IsNotFound(err))
return return
} }
assert.NilError(t, err) assert.NilError(t, err)
assert.DeepEqual(t, testcase.expected, actual, cmpReferenceNamed) assert.DeepEqual(t, tc.expected, actual, cmpReferenceNamed)
}) })
} }
} }