Skip to content

Commit

Permalink
Use if type conditional (#198)
Browse files Browse the repository at this point in the history
In that case if type is much simpler and look better.
  • Loading branch information
moredure committed Apr 2, 2022
1 parent fcd9aed commit f5dc865
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions token/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ func AuthKeyFromBytes(bytes []byte) (*ecdsa.PrivateKey, error) {
if err != nil {
return nil, err
}
switch pk := key.(type) {
case *ecdsa.PrivateKey:
if pk, ok := key.(*ecdsa.PrivateKey); ok {
return pk, nil
default:
return nil, ErrAuthKeyNotECDSA
}
return nil, ErrAuthKeyNotECDSA
}

// GenerateIfExpired checks to see if the token is about to expire and
Expand Down

0 comments on commit f5dc865

Please sign in to comment.