Format Go code

go fmt ./...
This commit is contained in:
Mike Fridman 2022-05-27 19:14:55 -04:00
parent 1697222a72
commit de7268f1f8
5 changed files with 8 additions and 7 deletions

View File

@ -110,13 +110,13 @@ func TestMapClaimsVerifyExpiresAtExpire(t *testing.T) {
t.Fatalf("Failed to verify claims, wanted: %v got %v", want, got) t.Fatalf("Failed to verify claims, wanted: %v got %v", want, got)
} }
got = mapClaims.VerifyExpiresAt(exp + 1, true) got = mapClaims.VerifyExpiresAt(exp+1, true)
if want != got { if want != got {
t.Fatalf("Failed to verify claims, wanted: %v got %v", want, got) t.Fatalf("Failed to verify claims, wanted: %v got %v", want, got)
} }
want = true want = true
got = mapClaims.VerifyExpiresAt(exp - 1, true) got = mapClaims.VerifyExpiresAt(exp-1, true)
if want != got { if want != got {
t.Fatalf("Failed to verify claims, wanted: %v got %v", want, got) t.Fatalf("Failed to verify claims, wanted: %v got %v", want, got)
} }

View File

@ -1,3 +1,4 @@
//go:build go1.4
// +build go1.4 // +build go1.4
package jwt package jwt

View File

@ -1,3 +1,4 @@
//go:build go1.4
// +build go1.4 // +build go1.4
package jwt_test package jwt_test

View File

@ -7,7 +7,6 @@ import (
"time" "time"
) )
// DecodePaddingAllowed will switch the codec used for decoding JWTs respectively. Note that the JWS RFC7515 // DecodePaddingAllowed will switch the codec used for decoding JWTs respectively. Note that the JWS RFC7515
// states that the tokens will utilize a Base64url encoding with no padding. Unfortunately, some implementations // states that the tokens will utilize a Base64url encoding with no padding. Unfortunately, some implementations
// of JWT are producing non-standard tokens, and thus require support for decoding. Note that this is a global // of JWT are producing non-standard tokens, and thus require support for decoding. Note that this is a global

View File

@ -34,7 +34,7 @@ func TestToken_SigningString(t1 *testing.T) {
Signature: "", Signature: "",
Valid: false, Valid: false,
}, },
want: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30", want: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30",
wantErr: false, wantErr: false,
}, },
} }
@ -62,17 +62,17 @@ func TestToken_SigningString(t1 *testing.T) {
func BenchmarkToken_SigningString(b *testing.B) { func BenchmarkToken_SigningString(b *testing.B) {
t := &jwt.Token{ t := &jwt.Token{
Method: jwt.SigningMethodHS256, Method: jwt.SigningMethodHS256,
Header: map[string]interface{}{ Header: map[string]interface{}{
"typ": "JWT", "typ": "JWT",
"alg": jwt.SigningMethodHS256.Alg(), "alg": jwt.SigningMethodHS256.Alg(),
}, },
Claims: jwt.StandardClaims{}, Claims: jwt.StandardClaims{},
} }
b.Run("BenchmarkToken_SigningString", func(b *testing.B) { b.Run("BenchmarkToken_SigningString", func(b *testing.B) {
b.ResetTimer() b.ResetTimer()
b.ReportAllocs() b.ReportAllocs()
for i := 0; i<b.N; i++ { for i := 0; i < b.N; i++ {
t.SigningString() t.SigningString()
} }
}) })