From a1fc99d08cda3b38414925dd708c1636a01c2706 Mon Sep 17 00:00:00 2001 From: "fox.cpp" Date: Wed, 22 Sep 2021 23:32:30 +0300 Subject: [PATCH] Fix a few minor warnings --- .golangci.yml | 2 +- framework/config/endpoint.go | 1 - internal/storage/blob/s3/s3.go | 8 ++++++-- internal/storage/blob/test_blob.go | 4 +++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index b29e9214..47b5bb3e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -17,4 +17,4 @@ linters: - whitespace - nakedret - dogsled - - scopelint + - exportloopref diff --git a/framework/config/endpoint.go b/framework/config/endpoint.go index 649a1177..210d57bb 100644 --- a/framework/config/endpoint.go +++ b/framework/config/endpoint.go @@ -79,7 +79,6 @@ func (e Endpoint) Address() string { return e.Path } return net.JoinHostPort(e.Host, e.Port) - } func (e Endpoint) IsTLS() bool { diff --git a/internal/storage/blob/s3/s3.go b/internal/storage/blob/s3/s3.go index 87cf859a..719ede6e 100644 --- a/internal/storage/blob/s3/s3.go +++ b/internal/storage/blob/s3/s3.go @@ -106,7 +106,9 @@ func (b *s3blob) Write(p []byte) (n int, err error) { func (b *s3blob) Close() error { if !b.didSync { - b.pw.CloseWithError(fmt.Errorf("storage.blob.s3: blob closed without Sync")) + if err := b.pw.CloseWithError(fmt.Errorf("storage.blob.s3: blob closed without Sync")); err != nil { + panic(err) + } } return nil } @@ -127,7 +129,9 @@ func (s *Store) Create(ctx context.Context, key string, blobSize int64) (module. PartSize: partSize, }) if err != nil { - pr.CloseWithError(fmt.Errorf("s3 PutObject: %w", err)) + if err := pr.CloseWithError(fmt.Errorf("s3 PutObject: %w", err)); err != nil { + panic(err) + } } errCh <- err }() diff --git a/internal/storage/blob/test_blob.go b/internal/storage/blob/test_blob.go index a3a3fae9..eead14dc 100644 --- a/internal/storage/blob/test_blob.go +++ b/internal/storage/blob/test_blob.go @@ -52,7 +52,9 @@ func TestStore(t *testing.T, newStore func() module.BlobStore, cleanStore func(m } cleanBackend := func(bi backendtests.Backend) { b := bi.(testBack) - b.Backend.(*imapsql.Backend).Close() + if err := b.Backend.(*imapsql.Backend).Close(); err != nil { + panic(err) + } cleanStore(b.ExtStore) }