@@ -27,25 +27,25 @@ func parseSSHKeyFile(sshPubKey string, keyName string, keyValue string, userEmai
2727 var err error
2828
2929 // will fail if value is not right
30- if strings .EqualFold (string (splitKey [0 ]), "ssh-rsa" ) {
30+ switch splitKey [0 ] {
31+ case "ssh-rsa" :
3132 keyType = schema .SSHRsa
32- } else if strings . EqualFold ( string ( splitKey [ 0 ]), "ssh-ed25519" ) {
33+ case "ssh-ed25519" :
3334 keyType = schema .SSHEd25519
34- } else if strings . EqualFold ( string ( splitKey [ 0 ]), "ecdsa-sha2-nistp256" ) {
35+ case "ecdsa-sha2-nistp256" :
3536 keyType = schema .SSHECDSA256
36- } else if strings . EqualFold ( string ( splitKey [ 0 ]), "ecdsa-sha2-nistp384" ) {
37+ case "ecdsa-sha2-nistp384" :
3738 keyType = schema .SSHECDSA384
38- } else if strings . EqualFold ( string ( splitKey [ 0 ]), "ecdsa-sha2-nistp521" ) {
39+ case "ecdsa-sha2-nistp521" :
3940 keyType = schema .SSHECDSA521
40- } else {
41- // return error stating key type not supported
41+ default :
4242 keyType = schema .SSHRsa
43- err = fmt .Errorf (fmt . Sprintf ( "SSH key type %s not supported" , splitKey [0 ]) )
43+ err = fmt .Errorf ("SSH key type %s not supported" , splitKey [0 ])
4444 }
4545
4646 // if the sshkey has a comment/name in it, we can use that
4747 if keyName == "" && len (splitKey ) == 3 {
48- //strip new line
48+ // strip new line
4949 keyName = stripNewLines (splitKey [2 ])
5050 } else if keyName == "" && len (splitKey ) == 2 {
5151 keyName = userEmail
@@ -373,7 +373,7 @@ var updateUserCmd = &cobra.Command{
373373}
374374
375375var getUserKeysCmd = & cobra.Command {
376- //@TODO: once individual user interaction comes in, this will need to be adjusted
376+ // @TODO: once individual user interaction comes in, this will need to be adjusted
377377 Use : "user-sshkeys" ,
378378 Aliases : []string {"us" },
379379 Short : "Get a user's SSH keys" ,
@@ -434,7 +434,7 @@ var getUserKeysCmd = &cobra.Command{
434434}
435435
436436var getAllUserKeysCmd = & cobra.Command {
437- //@TODO: once individual user interaction comes in, this will need to be adjusted
437+ // @TODO: once individual user interaction comes in, this will need to be adjusted
438438 Use : "all-user-sshkeys" ,
439439 Aliases : []string {"aus" },
440440 Short : "Get all user SSH keys" ,
@@ -479,10 +479,10 @@ var getAllUserKeysCmd = &cobra.Command{
479479 var data []output.Data
480480 for _ , userData := range userGroups {
481481 keyID := strconv .Itoa (int (userData .SSHKey .ID ))
482- userEmail := returnNonEmptyString (strings .Replace (userData .UserEmail , " " , "_" , - 1 ))
483- keyName := returnNonEmptyString (strings .Replace (userData .SSHKey .Name , " " , "_" , - 1 ))
484- keyValue := returnNonEmptyString (strings .Replace (userData .SSHKey .KeyValue , " " , "_" , - 1 ))
485- keyType := returnNonEmptyString (strings .Replace (string (userData .SSHKey .KeyType ), " " , "_" , - 1 ))
482+ userEmail := returnNonEmptyString (strings .ReplaceAll (userData .UserEmail , " " , "_" ))
483+ keyName := returnNonEmptyString (strings .ReplaceAll (userData .SSHKey .Name , " " , "_" ))
484+ keyValue := returnNonEmptyString (strings .ReplaceAll (userData .SSHKey .KeyValue , " " , "_" ))
485+ keyType := returnNonEmptyString (strings .ReplaceAll (string (userData .SSHKey .KeyType ), " " , "_" ))
486486 data = append (data , []string {
487487 keyID ,
488488 userEmail ,
0 commit comments