From 6f536a0d2dd1fc9f74b6085bbfde825a78fc8614 Mon Sep 17 00:00:00 2001 From: Jamie Stackhouse Date: Wed, 22 Jul 2015 13:48:42 -0300 Subject: [PATCH] Changed example to use Output test. --- example_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/example_test.go b/example_test.go index 6ffa8c0..4621ea0 100644 --- a/example_test.go +++ b/example_test.go @@ -2,6 +2,7 @@ package jwt_test import ( "fmt" + "time" "github.com/dgrijalva/jwt-go" ) @@ -18,18 +19,17 @@ func ExampleParse(myToken string, myLookupKey func(interface{}) (interface{}, er } } -func ExampleNew(mySigningKey []byte) (string, error) { +func ExampleNew() { // Create the token token := jwt.New(jwt.SigningMethodRS256) // Set some claims claims := token.Claims.(jwt.MapClaim) claims["foo"] = "bar" - claims["exp"] = 15000 + claims["exp"] = time.Unix(0, 0).Add(time.Hour * 1).Unix() - // Sign and get the complete encoded token as a string - tokenString, err := token.SignedString(mySigningKey) - return tokenString, err + fmt.Printf("%v\n", claims) + //Output: map[foo:bar exp:3600] } func ExampleNewWithClaims(mySigningKey []byte) (string, error) {