cli/command: 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:58:11 +01:00
parent b45477bffa
commit 67458f710d
72 changed files with 23 additions and 143 deletions

View File

@ -53,7 +53,6 @@ func TestEventsFormat(t *testing.T) {
}
for _, tc := range tests {
tc := tc
t.Run(tc.name, func(t *testing.T) {
// Set to UTC timezone as timestamps in output are
// printed in the current timezone

View File

@ -374,7 +374,6 @@ func TestPrettyPrintInfo(t *testing.T) {
expectedError: "errors pretty printing info",
},
} {
tc := tc
t.Run(tc.doc, func(t *testing.T) {
cli := test.NewFakeCli(&fakeClient{})
err := prettyPrintInfo(cli, tc.dockerInfo)
@ -452,7 +451,6 @@ func TestFormatInfo(t *testing.T) {
expectedError: `template: :1:2: executing "" at <.badString>: can't evaluate field badString in type system.dockerInfo`,
},
} {
tc := tc
t.Run(tc.doc, func(t *testing.T) {
cli := test.NewFakeCli(&fakeClient{})
info := dockerInfo{
@ -518,7 +516,6 @@ func TestNeedsServerInfo(t *testing.T) {
inf := dockerInfo{ClientInfo: &clientInfo{}}
for _, tc := range tests {
tc := tc
t.Run(tc.doc, func(t *testing.T) {
assert.Equal(t, needsServerInfo(tc.template, inf), tc.expected)
})