diff --git a/repo/blob/gcs/gcs_storage.go b/repo/blob/gcs/gcs_storage.go index 955e66cf7b8..6b8ed3b3db6 100644 --- a/repo/blob/gcs/gcs_storage.go +++ b/repo/blob/gcs/gcs_storage.go @@ -3,17 +3,13 @@ package gcs import ( "context" - "encoding/json" "fmt" "net/http" - "os" "strconv" "time" gcsclient "cloud.google.com/go/storage" "github.com/pkg/errors" - "golang.org/x/oauth2" - "golang.org/x/oauth2/google" "google.golang.org/api/googleapi" "google.golang.org/api/iterator" "google.golang.org/api/option" @@ -246,24 +242,6 @@ func (gcs *gcsStorage) toBlobID(blobName string) blob.ID { return blob.ID(blobName[len(gcs.Prefix):]) } -func tokenSourceFromCredentialsFile(ctx context.Context, fn string, scopes ...string) (oauth2.TokenSource, error) { - data, err := os.ReadFile(fn) //nolint:gosec - if err != nil { - return nil, errors.Wrap(err, "error reading credentials file") - } - - return tokenSourceFromCredentialsJSON(ctx, data, scopes...) -} - -func tokenSourceFromCredentialsJSON(ctx context.Context, data json.RawMessage, scopes ...string) (oauth2.TokenSource, error) { - creds, err := google.CredentialsFromJSON(ctx, data, scopes...) - if err != nil { - return nil, errors.Wrap(err, "google.CredentialsFromJSON") - } - - return creds.TokenSource, nil -} - // New creates new Google Cloud Storage-backed storage with specified options: // // - the 'BucketName' field is required and all other parameters are optional.