From 748e33104c55a557ba98e3c5f1247b7678e0384a Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 31 Jul 2020 11:50:27 -0700 Subject: [PATCH] Set context early on in LoadAndValidate to prevent NPE (#3800) (#488) Signed-off-by: Modular Magician --- google/config.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/google/config.go b/google/config.go index cbd366ae0..4370e563c 100644 --- a/google/config.go +++ b/google/config.go @@ -284,6 +284,8 @@ func (c *Config) LoadAndValidate(ctx context.Context) error { c.Scopes = DefaultClientScopes } + c.context = ctx + tokenSource, err := c.getTokenSource(c.Scopes) if err != nil { return err @@ -315,7 +317,6 @@ func (c *Config) LoadAndValidate(ctx context.Context) error { userAgent := fmt.Sprintf("%s %s", tfUserAgent, providerVersion) c.client = client - c.context = ctx c.userAgent = userAgent // This base path and some others below need the version and possibly more of the path