From 0ede19e2eef0c78269f676c64bf26773884a649b Mon Sep 17 00:00:00 2001 From: Ganesh Vernekar Date: Tue, 10 Feb 2026 13:03:14 -0800 Subject: [PATCH] Replace deprecated google.CredentialsFromJSON with option.WithAuthCredentialsFile Signed-off-by: Ganesh Vernekar --- storage/remote/googleiam/googleiam.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/storage/remote/googleiam/googleiam.go b/storage/remote/googleiam/googleiam.go index 0ca7185ab7..2095ee9747 100644 --- a/storage/remote/googleiam/googleiam.go +++ b/storage/remote/googleiam/googleiam.go @@ -19,7 +19,6 @@ import ( "context" "fmt" "net/http" - "os" "golang.org/x/oauth2/google" "google.golang.org/api/option" @@ -42,15 +41,7 @@ func NewRoundTripper(cfg *Config, next http.RoundTripper) (http.RoundTripper, er option.WithScopes(scopes), } if cfg.CredentialsFile != "" { - credBytes, err := os.ReadFile(cfg.CredentialsFile) - if err != nil { - return nil, fmt.Errorf("error reading Google credentials file: %w", err) - } - creds, err := google.CredentialsFromJSON(ctx, credBytes, scopes) - if err != nil { - return nil, fmt.Errorf("error parsing Google credentials file: %w", err) - } - opts = append(opts, option.WithCredentials(creds)) + opts = append(opts, option.WithAuthCredentialsFile(option.ServiceAccount, cfg.CredentialsFile)) } else { creds, err := google.FindDefaultCredentials(ctx, scopes) if err != nil {