mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-12 15:50:15 -08:00
ci(deps): fix ineffassign and bodyclose in ".*_test.go$" (#6777)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
@@ -109,10 +109,8 @@ issues:
|
||||
exclude-rules:
|
||||
- path: ".*_test.go$"
|
||||
linters:
|
||||
- bodyclose
|
||||
- goconst
|
||||
- gosec
|
||||
- ineffassign
|
||||
- misspell
|
||||
- unused
|
||||
- path: ".*_test.go$"
|
||||
|
||||
@@ -47,6 +47,7 @@ func Test_executableAnalyzer_Analyze(t *testing.T) {
|
||||
Content: f,
|
||||
Info: stat,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, tt.want, got)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -262,6 +262,8 @@ func Test_newServeMux(t *testing.T) {
|
||||
url := ts.URL + tt.path
|
||||
if tt.header == nil {
|
||||
resp, err = http.Get(url)
|
||||
require.NoError(t, err)
|
||||
defer resp.Body.Close()
|
||||
} else {
|
||||
req, err := http.NewRequest(http.MethodPost, url, http.NoBody)
|
||||
require.NoError(t, err)
|
||||
@@ -269,11 +271,10 @@ func Test_newServeMux(t *testing.T) {
|
||||
req.Header = tt.header
|
||||
client := new(http.Client)
|
||||
resp, err = client.Do(req)
|
||||
require.NoError(t, err)
|
||||
defer resp.Body.Close()
|
||||
}
|
||||
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, tt.want, resp.StatusCode)
|
||||
defer resp.Body.Close()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user