mirror of
https://github.com/octoleo/restic.git
synced 2024-11-21 20:35:12 +00:00
CI: enable bodyclose linter
This commit is contained in:
parent
b1a8fd1d03
commit
bd883caae1
@ -35,6 +35,9 @@ linters:
|
|||||||
# parse and typecheck code
|
# parse and typecheck code
|
||||||
- typecheck
|
- typecheck
|
||||||
|
|
||||||
|
# ensure that http response bodies are closed
|
||||||
|
- bodyclose
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
# don't use the default exclude rules, this hides (among others) ignored
|
# don't use the default exclude rules, this hides (among others) ignored
|
||||||
# errors from Close() calls
|
# errors from Close() calls
|
||||||
|
@ -118,6 +118,7 @@ func TestRoundTripperReader(t *testing.T) {
|
|||||||
test.Assert(t, bytes.Equal(data, out.Bytes()), "data ping-pong failed")
|
test.Assert(t, bytes.Equal(data, out.Bytes()), "data ping-pong failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint:bodyclose // the http response is just a mock
|
||||||
func TestRoundTripperCornerCases(t *testing.T) {
|
func TestRoundTripperCornerCases(t *testing.T) {
|
||||||
limiter := NewStaticLimiter(Limits{42 * 1024, 42 * 1024})
|
limiter := NewStaticLimiter(Limits{42 * 1024, 42 * 1024})
|
||||||
|
|
||||||
|
@ -252,6 +252,7 @@ func newBackend(ctx context.Context, cfg Config, lim limiter.Limiter) (*Backend,
|
|||||||
return nil, fmt.Errorf("error talking HTTP to rclone: %w", err)
|
return nil, fmt.Errorf("error talking HTTP to rclone: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_ = res.Body.Close()
|
||||||
debug.Log("HTTP status %q returned, moving instance to background", res.Status)
|
debug.Log("HTTP status %q returned, moving instance to background", res.Status)
|
||||||
err = bg()
|
err = bg()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user