cli/compose: 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:
Родитель
67458f710d
Коммит
1448cecba1
|
@ -409,7 +409,6 @@ func TestConvertCredentialSpec(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
namespace := NewNamespace(tc.name)
|
||||
swarmSpec, err := convertCredentialSpec(namespace, tc.in, tc.configs)
|
||||
|
@ -691,7 +690,6 @@ func TestConvertServiceCapAddAndCapDrop(t *testing.T) {
|
|||
},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
t.Run(tc.title, func(t *testing.T) {
|
||||
result, err := Service("1.41", Namespace{name: "foo"}, tc.in, nil, nil, nil, nil)
|
||||
assert.NilError(t, err)
|
||||
|
|
|
@ -1626,13 +1626,12 @@ services:
|
|||
init: &booleanFalse,
|
||||
},
|
||||
}
|
||||
for _, testcase := range testcases {
|
||||
testcase := testcase
|
||||
t.Run(testcase.doc, func(t *testing.T) {
|
||||
config, err := loadYAML(testcase.yaml)
|
||||
for _, tc := range testcases {
|
||||
t.Run(tc.doc, func(t *testing.T) {
|
||||
config, err := loadYAML(tc.yaml)
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Len(config.Services, 1))
|
||||
assert.Check(t, is.DeepEqual(testcase.init, config.Services[0].Init))
|
||||
assert.Check(t, is.DeepEqual(tc.init, config.Services[0].Init))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -215,7 +215,6 @@ func TestValidateCredentialSpecs(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
t.Run(tc.version, func(t *testing.T) {
|
||||
config := dict{
|
||||
"version": "99.99",
|
||||
|
|
|
@ -277,7 +277,6 @@ func TestExtractVariables(t *testing.T) {
|
|||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
actual := ExtractVariables(tc.dict, defaultPattern)
|
||||
assert.Check(t, is.DeepEqual(actual, tc.expected))
|
||||
|
|
Загрузка…
Ссылка в новой задаче