From c13a483e325d9e1e0e9132cafc8c47b8e12c8372 Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Mon, 27 Jul 2020 22:42:20 +0200 Subject: [PATCH] Compact decoder in verifyAuthCode --- cmd/eksterd/http.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmd/eksterd/http.go b/cmd/eksterd/http.go index b2d5241..b352117 100644 --- a/cmd/eksterd/http.go +++ b/cmd/eksterd/http.go @@ -182,10 +182,9 @@ func verifyAuthCode(code, redirectURI, authEndpoint, clientID string) (bool, *au } input := io.TeeReader(resp.Body, os.Stderr) - dec := json.NewDecoder(input) + var authResponse authResponse - err = dec.Decode(&authResponse) - if err != nil { + if err := json.NewDecoder(input).Decode(&authResponse); err != nil { return false, nil, fmt.Errorf("while verifying authentication response from %s: %s", authEndpoint, err) }