From d9df83c8271c7383117aef118ae3b84feca03f23 Mon Sep 17 00:00:00 2001 From: Dave Grijalva Date: Fri, 13 Nov 2015 15:03:12 -0800 Subject: [PATCH] use cleaner version of prefix checking (thanks shurcooL) --- cmd/jwt/app.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/jwt/app.go b/cmd/jwt/app.go index a78d81a..4068a80 100644 --- a/cmd/jwt/app.go +++ b/cmd/jwt/app.go @@ -14,6 +14,7 @@ import ( "io/ioutil" "os" "regexp" + "strings" "github.com/dgrijalva/jwt-go" ) @@ -205,8 +206,5 @@ func signToken() error { } func isEs() bool { - if alg := *flagAlg; len(alg) >= 2 && alg[0:2] == "ES" { - return true - } - return false + return strings.HasPrefix(*flagAlg, "ES") }