Skip to content

Commit

Permalink
updated manager call signture
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianwit@gmail.com authored and adrianwit@gmail.com committed Sep 25, 2019
1 parent ce4fcdf commit 824044e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion move.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (s *service) Move(ctx context.Context, sourceURL, destURL string, options .
destOptions := option.NewDest()
option.Assign(options, &sourceOptions, &destOptions)
if sourceScheme == destScheme {
if manager, err := s.manager(ctx, sourceURL, *sourceOptions...); err == nil {
if manager, err := s.manager(ctx, sourceURL, *sourceOptions); err == nil {
if mover, ok := manager.(storage.Mover); ok {
return mover.Move(ctx, sourceURL, destURL, options...)
}
Expand Down
22 changes: 11 additions & 11 deletions service.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type service struct {

func (s *service) List(ctx context.Context, URL string, options ...storage.Option) ([]storage.Object, error) {
URL = url.Normalize(URL, file.Scheme)
manager, err := s.manager(ctx, URL, options...)
manager, err := s.manager(ctx, URL, options)
if err != nil {
return nil, err
}
Expand All @@ -61,7 +61,7 @@ func (s *service) List(ctx context.Context, URL string, options ...storage.Optio

func (s *service) Upload(ctx context.Context, URL string, mode os.FileMode, reader io.Reader, options ...storage.Option) error {
URL = url.Normalize(URL, file.Scheme)
manager, err := s.manager(ctx, URL, options...)
manager, err := s.manager(ctx, URL, options)
if err != nil {
return err
}
Expand All @@ -74,7 +74,7 @@ func (s *service) Download(ctx context.Context, object storage.Object, options .
}
var modifier option.Modifier
option.Assign(options, &modifier)
manager, err := s.manager(ctx, object.URL(), options...)
manager, err := s.manager(ctx, object.URL(), options)
if err != nil {
return nil, err
}
Expand All @@ -88,7 +88,7 @@ func (s *service) Download(ctx context.Context, object storage.Object, options .

func (s *service) Delete(ctx context.Context, URL string, options ...storage.Option) error {
URL = url.Normalize(URL, file.Scheme)
manager, err := s.manager(ctx, URL, options...)
manager, err := s.manager(ctx, URL, options)
if err != nil {
return err
}
Expand All @@ -97,15 +97,15 @@ func (s *service) Delete(ctx context.Context, URL string, options ...storage.Opt

func (s *service) Create(ctx context.Context, URL string, mode os.FileMode, isDir bool, options ...storage.Option) error {
URL = url.Normalize(URL, file.Scheme)
manager, err := s.manager(ctx, URL, options...)
manager, err := s.manager(ctx, URL, options)
if err != nil {
return err
}
return manager.Create(ctx, URL, mode, isDir, options...)
}

func (s *service) Object(ctx context.Context, URL string, options ...storage.Option) (storage.Object, error) {
manager, err := s.manager(ctx, URL, options...)
manager, err := s.manager(ctx, URL, options)
if err != nil {
return nil, err
}
Expand All @@ -125,7 +125,7 @@ func (s *service) object(ctx context.Context, manager storage.Manager, URL strin

func (s *service) Exists(ctx context.Context, URL string, options ...storage.Option) (bool, error) {
URL = url.Normalize(URL, file.Scheme)
manager, err := s.manager(ctx, URL, options...)
manager, err := s.manager(ctx, URL, options)
if err != nil {
return false, err
}
Expand All @@ -147,7 +147,7 @@ func (s *service) DownloadWithURL(ctx context.Context, URL string, options ...st
URL = url.Normalize(URL, file.Scheme)
var modifier option.Modifier
option.Assign(options, &modifier)
manager, err := s.manager(ctx, URL, options...)
manager, err := s.manager(ctx, URL, options)
if err != nil {
return nil, err
}
Expand All @@ -174,7 +174,7 @@ func (s *service) newManager(ctx context.Context, scheme string, options ...stor

func (s *service) Init(ctx context.Context, baseURL string, options ...storage.Option) error {
baseURL = url.Normalize(baseURL, file.Scheme)
_, err := s.manager(ctx, baseURL, options...)
_, err := s.manager(ctx, baseURL, options)
return err
}

Expand Down Expand Up @@ -203,7 +203,7 @@ func (s *service) CloseAll() error {
return err
}

func (s *service) manager(ctx context.Context, URL string, options ...storage.Option) (storage.Manager, error) {
func (s *service) manager(ctx context.Context, URL string, options []storage.Option) (storage.Manager, error) {
scheme := url.Scheme(URL, file.Scheme)
noCache := &option.NoCache{}
options, _ = option.Assign(options, &noCache)
Expand All @@ -216,7 +216,7 @@ func (s *service) manager(ctx context.Context, URL string, options ...storage.Op

if extURL != "" {
if extScheme := url.Scheme(extURL, file.Scheme); extScheme != scheme {
extManager, err := s.manager(ctx, extURL, options...)
extManager, err := s.manager(ctx, extURL, options)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 824044e

Please sign in to comment.