From 4e40ee8059695468e62ba9213058b5cc1e4a8e0a Mon Sep 17 00:00:00 2001 From: cui fliter Date: Wed, 7 Sep 2022 21:13:45 +0800 Subject: [PATCH] all: remove redundant type conversion Signed-off-by: cui fliter --- google/jwt_test.go | 4 ++-- jira/jira.go | 2 +- jws/jws.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/google/jwt_test.go b/google/jwt_test.go index 043f445..5890ae9 100644 --- a/google/jwt_test.go +++ b/google/jwt_test.go @@ -73,7 +73,7 @@ func TestJWTAccessTokenSourceFromJSON(t *testing.T) { t.Fatalf("base64 DecodeString: %v\nString: %q", err, parts[0]) } var hdr jws.Header - if err := json.Unmarshal([]byte(hdrJSON), &hdr); err != nil { + if err := json.Unmarshal(hdrJSON, &hdr); err != nil { t.Fatalf("json.Unmarshal: %v (%q)", err, hdrJSON) } @@ -129,7 +129,7 @@ func TestJWTAccessTokenSourceWithScope(t *testing.T) { t.Fatalf("base64 DecodeString: %v\nString: %q", err, parts[0]) } var hdr jws.Header - if err := json.Unmarshal([]byte(hdrJSON), &hdr); err != nil { + if err := json.Unmarshal(hdrJSON, &hdr); err != nil { t.Fatalf("json.Unmarshal: %v (%q)", err, hdrJSON) } diff --git a/jira/jira.go b/jira/jira.go index 39aa713..814656e 100644 --- a/jira/jira.go +++ b/jira/jira.go @@ -105,7 +105,7 @@ func (js jwtSource) Token() (*oauth2.Token, error) { if err != nil { return nil, err } - v.Set("assertion", string(assertion)) + v.Set("assertion", assertion) // Fetch access token from auth server hc := oauth2.NewClient(js.ctx, nil) diff --git a/jws/jws.go b/jws/jws.go index 683d2d2..9501564 100644 --- a/jws/jws.go +++ b/jws/jws.go @@ -178,5 +178,5 @@ func Verify(token string, key *rsa.PublicKey) error { h := sha256.New() h.Write([]byte(signedContent)) - return rsa.VerifyPKCS1v15(key, crypto.SHA256, h.Sum(nil), []byte(signatureString)) + return rsa.VerifyPKCS1v15(key, crypto.SHA256, h.Sum(nil), signatureString) }