service/logs: Using the variable on range scope `testcase` in function literal (scopelint)

```
service/logs/parse_logs_test.go:26:35: Using the variable on range scope `testcase` in function literal (scopelint)
			actual, err := ParseLogDetails(testcase.line)
			                               ^
service/logs/parse_logs_test.go:27:7: Using the variable on range scope `testcase` in function literal (scopelint)
			if testcase.err != nil {
			   ^
service/logs/parse_logs_test.go:28:26: Using the variable on range scope `testcase` in function literal (scopelint)
				assert.Error(t, err, testcase.err.Error())
				                     ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit c828fa141d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-10-29 13:34:33 +01:00
parent 43b498829b
commit a087595fb6
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 1 additions and 0 deletions

View File

@ -22,6 +22,7 @@ func TestParseLogDetails(t *testing.T) {
{"errors", nil, errors.New("invalid details format")}, {"errors", nil, errors.New("invalid details format")},
} }
for _, testcase := range testCases { for _, testcase := range testCases {
testcase := testcase
t.Run(testcase.line, func(t *testing.T) { t.Run(testcase.line, func(t *testing.T) {
actual, err := ParseLogDetails(testcase.line) actual, err := ParseLogDetails(testcase.line)
if testcase.err != nil { if testcase.err != nil {