From 6f9c1a18cc48103b815a810b907f038d953749a9 Mon Sep 17 00:00:00 2001 From: Koichi Shiraishi Date: Tue, 14 Jun 2022 10:57:10 +0900 Subject: [PATCH] google: use Credentials instead of deprecated DefaultCredentials Change-Id: Ie2d972df025f6b6b7d172015aae7eb34e355cb28 Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/412034 Reviewed-by: Matt Hickford TryBot-Result: Gopher Robot Run-TryBot: Cody Oss Reviewed-by: Matthew Hickford Run-TryBot: Matt Hickford Auto-Submit: Dmitri Shuralyov Reviewed-by: Cody Oss --- google/default.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/google/default.go b/google/default.go index 7ed02cd..a144d78 100644 --- a/google/default.go +++ b/google/default.go @@ -137,7 +137,7 @@ func FindDefaultCredentialsWithParams(ctx context.Context, params CredentialsPar // use those credentials. App Engine standard second generation runtimes (>= Go 1.11) // and App Engine flexible use ComputeTokenSource and the metadata server. if appengineTokenFunc != nil { - return &DefaultCredentials{ + return &Credentials{ ProjectID: appengineAppIDFunc(ctx), TokenSource: AppEngineTokenSource(ctx, params.Scopes...), }, nil @@ -147,7 +147,7 @@ func FindDefaultCredentialsWithParams(ctx context.Context, params CredentialsPar // or App Engine flexible, use the metadata server. if metadata.OnGCE() { id, _ := metadata.ProjectID() - return &DefaultCredentials{ + return &Credentials{ ProjectID: id, TokenSource: ComputeTokenSource("", params.Scopes...), }, nil @@ -194,7 +194,7 @@ func CredentialsFromJSONWithParams(ctx context.Context, jsonData []byte, params return nil, err } ts = newErrWrappingTokenSource(ts) - return &DefaultCredentials{ + return &Credentials{ ProjectID: f.ProjectID, TokenSource: ts, JSON: jsonData, @@ -216,7 +216,7 @@ func wellKnownFile() string { return filepath.Join(guessUnixHomeDir(), ".config", "gcloud", f) } -func readCredentialsFile(ctx context.Context, filename string, params CredentialsParams) (*DefaultCredentials, error) { +func readCredentialsFile(ctx context.Context, filename string, params CredentialsParams) (*Credentials, error) { b, err := ioutil.ReadFile(filename) if err != nil { return nil, err