diff --git a/cli/compose/convert/service_test.go b/cli/compose/convert/service_test.go index 22f585f87c..a7c8bf28ca 100644 --- a/cli/compose/convert/service_test.go +++ b/cli/compose/convert/service_test.go @@ -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) diff --git a/cli/compose/loader/loader_test.go b/cli/compose/loader/loader_test.go index 47a30ebd0e..c1d7af3641 100644 --- a/cli/compose/loader/loader_test.go +++ b/cli/compose/loader/loader_test.go @@ -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)) }) } } diff --git a/cli/compose/schema/schema_test.go b/cli/compose/schema/schema_test.go index 33a992a362..9738494156 100644 --- a/cli/compose/schema/schema_test.go +++ b/cli/compose/schema/schema_test.go @@ -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", diff --git a/cli/compose/template/template_test.go b/cli/compose/template/template_test.go index 0d0a92e709..5482342f80 100644 --- a/cli/compose/template/template_test.go +++ b/cli/compose/template/template_test.go @@ -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))