mirror of https://github.com/docker/cli.git
opts: Using the variable on range scope `tc` in function literal (scopelint)
``` opts/network_test.go:74:35: Using the variable on range scope `tc` in function literal (scopelint) assert.NilError(t, network.Set(tc.value)) ^ opts/network_test.go:102:40: Using the variable on range scope `tc` in function literal (scopelint) assert.ErrorContains(t, network.Set(tc.value), tc.expectedError) ^ opts/opts_test.go:270:30: Using the variable on range scope `tc` in function literal (scopelint) val, err := ValidateLabel(tc.value) ^ opts/opts_test.go:271:7: Using the variable on range scope `tc` in function literal (scopelint) if tc.expectedErr != "" { ^ ``` Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
cd3dca37b8
commit
c2b069f4db
|
@ -69,6 +69,7 @@ func TestNetworkOptAdvancedSyntax(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
|
tc := tc
|
||||||
t.Run(tc.value, func(t *testing.T) {
|
t.Run(tc.value, func(t *testing.T) {
|
||||||
var network NetworkOpt
|
var network NetworkOpt
|
||||||
assert.NilError(t, network.Set(tc.value))
|
assert.NilError(t, network.Set(tc.value))
|
||||||
|
@ -96,6 +97,7 @@ func TestNetworkOptAdvancedSyntaxInvalid(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
|
tc := tc
|
||||||
t.Run(tc.value, func(t *testing.T) {
|
t.Run(tc.value, func(t *testing.T) {
|
||||||
var network NetworkOpt
|
var network NetworkOpt
|
||||||
assert.ErrorContains(t, network.Set(tc.value), tc.expectedError)
|
assert.ErrorContains(t, network.Set(tc.value), tc.expectedError)
|
||||||
|
|
|
@ -266,6 +266,7 @@ func TestValidateLabel(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
|
tc := tc
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
val, err := ValidateLabel(tc.value)
|
val, err := ValidateLabel(tc.value)
|
||||||
if tc.expectedErr != "" {
|
if tc.expectedErr != "" {
|
||||||
|
|
Loading…
Reference in New Issue