diff --git a/storage/s3.go b/storage/s3.go index 6b8931ea..63bff362 100644 --- a/storage/s3.go +++ b/storage/s3.go @@ -15,6 +15,7 @@ import ( "github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3/s3manager" "github.com/pkg/errors" + "github.com/satisfactorymodding/smr-api/redis" ) diff --git a/storage/wrapper.go b/storage/wrapper.go index ea4bde2e..28403226 100644 --- a/storage/wrapper.go +++ b/storage/wrapper.go @@ -3,6 +3,7 @@ package storage import ( "bytes" "context" + "fmt" "io" "log/slog" ) @@ -21,7 +22,6 @@ func initializeWrapper(reader Storage, writer Storage) *Wrapper { func (w *Wrapper) Get(key string) (io.ReadCloser, error) { get, err := w.Writer.Get(key) - if err != nil { return w.Reader.Get(key) } @@ -71,7 +71,7 @@ func (w *Wrapper) Rename(from string, to string) error { defer get.Close() all, err := io.ReadAll(get) if err != nil { - return err + return fmt.Errorf("failed reading file: %w", err) } if _, err := w.Writer.Put(context.Background(), from, bytes.NewReader(all)); err != nil { @@ -92,7 +92,6 @@ func (w *Wrapper) Delete(key string) error { func (w *Wrapper) Meta(key string) (*ObjectMeta, error) { get, err := w.Writer.Meta(key) - if err != nil { return w.Reader.Meta(key) } @@ -102,7 +101,6 @@ func (w *Wrapper) Meta(key string) (*ObjectMeta, error) { func (w *Wrapper) List(prefix string) ([]Object, error) { get, err := w.Writer.List(prefix) - if err != nil { return w.Reader.List(prefix) } diff --git a/tests/setup_test.go b/tests/setup_test.go index dba452ed..8b2c8e9e 100644 --- a/tests/setup_test.go +++ b/tests/setup_test.go @@ -2,12 +2,13 @@ package tests import ( "context" + "testing" + smr "github.com/satisfactorymodding/smr-api/api" "github.com/satisfactorymodding/smr-api/validation" - "testing" ) -func TestSetup(t *testing.T) { +func TestSetup(_ *testing.T) { validation.StaticPath = "../static" ctx, _ := smr.Initialize(context.Background()) smr.Migrate(ctx)