diff --git a/opts/network_test.go b/opts/network_test.go index 1867d8ac8b..0d38955dc5 100644 --- a/opts/network_test.go +++ b/opts/network_test.go @@ -69,6 +69,7 @@ func TestNetworkOptAdvancedSyntax(t *testing.T) { }, } for _, tc := range testCases { + tc := tc t.Run(tc.value, func(t *testing.T) { var network NetworkOpt assert.NilError(t, network.Set(tc.value)) @@ -96,6 +97,7 @@ func TestNetworkOptAdvancedSyntaxInvalid(t *testing.T) { }, } for _, tc := range testCases { + tc := tc t.Run(tc.value, func(t *testing.T) { var network NetworkOpt assert.ErrorContains(t, network.Set(tc.value), tc.expectedError) diff --git a/opts/opts_test.go b/opts/opts_test.go index 4d5ef1749e..9c9f9689ff 100644 --- a/opts/opts_test.go +++ b/opts/opts_test.go @@ -266,6 +266,7 @@ func TestValidateLabel(t *testing.T) { } for _, tc := range tests { + tc := tc t.Run(tc.name, func(t *testing.T) { val, err := ValidateLabel(tc.value) if tc.expectedErr != "" {