From 3454980053af0816576b72ff64fecffec8d5930a Mon Sep 17 00:00:00 2001 From: Patrick Jones Date: Tue, 12 Jan 2021 13:02:21 -0800 Subject: [PATCH] go fmt Change-Id: Ie9d82a9c162eb72f63ebd75a284083eb4318d6d1 --- google/google.go | 33 +++++++++---------- .../internal/externalaccount/urlcredsource.go | 6 ++-- .../externalaccount/urlcredsource_test.go | 9 ++--- 3 files changed, 22 insertions(+), 26 deletions(-) diff --git a/google/google.go b/google/google.go index e247491..2c8f1bd 100644 --- a/google/google.go +++ b/google/google.go @@ -115,14 +115,13 @@ type credentialsFile struct { RefreshToken string `json:"refresh_token"` // External Account fields - Audience string `json:"audience"` - SubjectTokenType string `json:"subject_token_type"` - TokenURLExternal string `json:"token_url"` - TokenInfoURL string `json:"token_info_url"` - ServiceAccountImpersonationURL string `json:"service_account_impersonation_url"` - CredentialSource externalaccount.CredentialSource `json:"credential_source"` - QuotaProjectID string `json:"quota_project_id"` - + Audience string `json:"audience"` + SubjectTokenType string `json:"subject_token_type"` + TokenURLExternal string `json:"token_url"` + TokenInfoURL string `json:"token_info_url"` + ServiceAccountImpersonationURL string `json:"service_account_impersonation_url"` + CredentialSource externalaccount.CredentialSource `json:"credential_source"` + QuotaProjectID string `json:"quota_project_id"` } func (f *credentialsFile) jwtConfig(scopes []string) *jwt.Config { @@ -155,16 +154,16 @@ func (f *credentialsFile) tokenSource(ctx context.Context, scopes []string) (oau return cfg.TokenSource(ctx, tok), nil case externalAccountKey: cfg := &externalaccount.Config{ - Audience: f.Audience, - SubjectTokenType: f.SubjectTokenType, - TokenURL: f.TokenURLExternal, - TokenInfoURL: f.TokenInfoURL, + Audience: f.Audience, + SubjectTokenType: f.SubjectTokenType, + TokenURL: f.TokenURLExternal, + TokenInfoURL: f.TokenInfoURL, ServiceAccountImpersonationURL: f.ServiceAccountImpersonationURL, - ClientSecret: f.ClientSecret, - ClientID: f.ClientID, - CredentialSource: f.CredentialSource, - QuotaProjectID: f.QuotaProjectID, - Scopes: scopes, + ClientSecret: f.ClientSecret, + ClientID: f.ClientID, + CredentialSource: f.CredentialSource, + QuotaProjectID: f.QuotaProjectID, + Scopes: scopes, } return cfg.TokenSource(ctx), nil case "": diff --git a/google/internal/externalaccount/urlcredsource.go b/google/internal/externalaccount/urlcredsource.go index 633dc6e..0318d48 100644 --- a/google/internal/externalaccount/urlcredsource.go +++ b/google/internal/externalaccount/urlcredsource.go @@ -15,9 +15,9 @@ import ( ) type urlCredentialSource struct { - URL string + URL string Headers map[string]string - Format format + Format format } func (cs urlCredentialSource) subjectToken() (string, error) { @@ -64,4 +64,4 @@ func (cs urlCredentialSource) subjectToken() (string, error) { return "", errors.New("oauth2/google: invalid credential_source file format type") } -} \ No newline at end of file +} diff --git a/google/internal/externalaccount/urlcredsource_test.go b/google/internal/externalaccount/urlcredsource_test.go index a1a6a95..5d66c2f 100644 --- a/google/internal/externalaccount/urlcredsource_test.go +++ b/google/internal/externalaccount/urlcredsource_test.go @@ -13,8 +13,6 @@ import ( var myURLToken = "testTokenValue" - - func TestRetrieveURLSubjectToken_Text(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -24,7 +22,7 @@ func TestRetrieveURLSubjectToken_Text(t *testing.T) { w.Write([]byte("testTokenValue")) })) cs := CredentialSource{ - URL: ts.URL, + URL: ts.URL, Format: format{Type: fileTypeText}, } tfc := testFileConfig @@ -81,7 +79,7 @@ func TestRetrieveURLSubjectToken_JSON(t *testing.T) { w.Write(jsonResp) })) cs := CredentialSource{ - URL: ts.URL, + URL: ts.URL, Format: format{Type: fileTypeJSON, SubjectTokenFieldName: "SubjToken"}, } tfc := testFileConfig @@ -89,7 +87,6 @@ func TestRetrieveURLSubjectToken_JSON(t *testing.T) { out, err := tfc.parse().subjectToken() - if err != nil { t.Fatalf("%v", err) } @@ -97,4 +94,4 @@ func TestRetrieveURLSubjectToken_JSON(t *testing.T) { t.Errorf("got %v but want %v", out, myURLToken) } -} \ No newline at end of file +}