Skip to content

Commit

Permalink
opts: Using the variable on range scope tc in function literal (sco…
Browse files Browse the repository at this point in the history
…pelint)

```
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>
  • Loading branch information
thaJeztah committed Oct 31, 2019
1 parent cd3dca3 commit c2b069f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions opts/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions opts/opts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand Down

0 comments on commit c2b069f

Please sign in to comment.