Browse Source

fix(gcs): use %w for error wrapping in gcs_storage_client.go

Address review feedback to use idiomatic error wrapping.
pull/8013/head
Chris Lu 6 hours ago
parent
commit
7ddaf9667d
  1. 4
      weed/remote_storage/gcs/gcs_storage_client.go

4
weed/remote_storage/gcs/gcs_storage_client.go

@ -65,12 +65,12 @@ func (s gcsRemoteStorageMaker) Make(conf *remote_pb.RemoteConf) (remote_storage.
} else {
data, err = os.ReadFile(googleApplicationCredentials)
if err != nil {
return nil, fmt.Errorf("failed to read credentials file %s: %v", googleApplicationCredentials, err)
return nil, fmt.Errorf("failed to read credentials file %s: %w", googleApplicationCredentials, err)
}
}
creds, err := google.CredentialsFromJSON(context.Background(), data, storage.ScopeFullControl)
if err != nil {
return nil, fmt.Errorf("failed to parse credentials: %v", err)
return nil, fmt.Errorf("failed to parse credentials: %w", err)
}
httpClient := oauth2.NewClient(context.Background(), creds.TokenSource)
clientOpts = append(clientOpts, option.WithHTTPClient(httpClient), option.WithoutAuthentication())

Loading…
Cancel
Save