Skip to content

Commit f5dc865

Browse files
authored
Use if type conditional (#198)
In that case if type is much simpler and look better.
1 parent fcd9aed commit f5dc865

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

token/token.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,10 @@ func AuthKeyFromBytes(bytes []byte) (*ecdsa.PrivateKey, error) {
5858
if err != nil {
5959
return nil, err
6060
}
61-
switch pk := key.(type) {
62-
case *ecdsa.PrivateKey:
61+
if pk, ok := key.(*ecdsa.PrivateKey); ok {
6362
return pk, nil
64-
default:
65-
return nil, ErrAuthKeyNotECDSA
6663
}
64+
return nil, ErrAuthKeyNotECDSA
6765
}
6866

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

0 commit comments

Comments
 (0)