From dcaf572f3d2e6c512f72c8f6f5a5a04c2ba421be Mon Sep 17 00:00:00 2001 From: Stefan Benten Date: Sun, 29 Dec 2019 15:16:07 +0100 Subject: [PATCH] Remove Error Wrapping and update Dependencies --- go.mod | 4 ++-- go.sum | 5 +++++ server/storage.go | 19 ++++++++----------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index b86b9c8..6c77697 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,6 @@ require ( github.com/stretchr/testify v1.4.0 // indirect github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce github.com/urfave/cli v1.22.1 - github.com/zeebo/errs v1.2.2 go.opencensus.io v0.22.1 // indirect golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc golang.org/x/net v0.0.0-20191007182048-72f939374954 @@ -37,5 +36,6 @@ require ( google.golang.org/genproto v0.0.0-20191007162740-aa923e3a3354 // indirect google.golang.org/grpc v1.24.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 - storj.io/storj v0.26.0 + storj.io/common v0.0.0-20191227171830-e979646db161 + storj.io/storj v0.28.3 ) diff --git a/go.sum b/go.sum index d760767..56d56b6 100644 --- a/go.sum +++ b/go.sum @@ -594,7 +594,12 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +storj.io/common v0.0.0-20191227171830-e979646db161 h1:OR98TPop3UnaFlNdtYYU6ZJyvB5A240kMnD5vtrueKE= +storj.io/common v0.0.0-20191227171830-e979646db161/go.mod h1:TYezVM4WnpfGDjaDdSKxmn02ioNVl0NLHIOVwATAq94= storj.io/drpc v0.0.7-0.20191115031725-2171c57838d2 h1:8SgLYEhe99R8QlAD1EAOBPRyIR+cn2hqkXtWlAUPf/c= storj.io/drpc v0.0.7-0.20191115031725-2171c57838d2/go.mod h1:/ascUDbzNAv0A3Jj7wUIKFBH2JdJ2uJIBO/b9+2yHgQ= storj.io/storj v0.26.0 h1:Q2oKu+qch0h0aZb5mOJPC6GaoATaX33Cu7+9kr45+Ws= storj.io/storj v0.26.0/go.mod h1:dgj21C3P1aD0Xwu6HvSWUOspIj3wvplbpYYRGiRfzAs= +storj.io/storj v0.28.2/go.mod h1:EOPjeCQTZQR2ml3dUh0EdU14N1SF+EIA6qwXbQponU4= +storj.io/storj v0.28.3 h1:JptRjcprY7MSbXivl6iPT/GX3e9Uw85ahK0/ef/j420= +storj.io/storj v0.28.3/go.mod h1:EOPjeCQTZQR2ml3dUh0EdU14N1SF+EIA6qwXbQponU4= diff --git a/server/storage.go b/server/storage.go index 0554f3c..d49bd64 100644 --- a/server/storage.go +++ b/server/storage.go @@ -17,15 +17,14 @@ import ( "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3/s3manager" - "github.com/zeebo/errs" "golang.org/x/net/context" "golang.org/x/oauth2" "golang.org/x/oauth2/google" "google.golang.org/api/drive/v3" "google.golang.org/api/googleapi" + "storj.io/common/storj" "storj.io/storj/lib/uplink" - "storj.io/storj/pkg/storj" ) type Storage interface { @@ -566,8 +565,6 @@ func saveGDriveToken(path string, token *oauth2.Token, logger *log.Logger) { json.NewEncoder(f).Encode(token) } -var uplinkFailure = errs.Class("storj failure") - type StorjStorage struct { Storage uplink *uplink.Uplink @@ -589,22 +586,22 @@ func NewStorjStorage(scope, bucket string, skipCA bool, logger *log.Logger) (*St parsedScope, err := uplink.ParseScope(scope) if err != nil { - return nil, uplinkFailure.Wrap(err) + return nil, err } instance.uplink, err = uplink.NewUplink(ctx, &config) if err != nil { - return nil, uplinkFailure.Wrap(err) + return nil, err } instance.project, err = instance.uplink.OpenProject(ctx, parsedScope.SatelliteAddr, parsedScope.APIKey) if err != nil { - return nil, uplinkFailure.Wrap(err) + return nil, err } instance.bucket, err = instance.project.OpenBucket(ctx, bucket, parsedScope.EncryptionAccess) if err != nil { - return nil, uplinkFailure.Wrap(err) + return nil, err } instance.logger = logger @@ -623,7 +620,7 @@ func (s *StorjStorage) Head(token string, filename string) (contentType string, obj, err := s.bucket.OpenObject(ctx, key) if err != nil { - return "", 0, uplinkFailure.Wrap(err) + return "", 0, err } contentType = obj.Meta.ContentType contentLength = uint64(obj.Meta.Size) @@ -640,7 +637,7 @@ func (s *StorjStorage) Get(token string, filename string) (reader io.ReadCloser, obj, err := s.bucket.OpenObject(ctx, key) if err != nil { - return nil, "", 0, uplinkFailure.Wrap(err) + return nil, "", 0, err } contentType = obj.Meta.ContentType contentLength = uint64(obj.Meta.Size) @@ -669,7 +666,7 @@ func (s *StorjStorage) Put(token string, filename string, reader io.Reader, cont err = s.bucket.UploadObject(ctx, key, reader, &uplink.UploadOptions{ContentType: contentType}) if err != nil { - return uplinkFailure.Wrap(err) + return err } return nil }