Skip to content

Commit

Permalink
GitHub: don't fail if a user has no SSH keys, take #2.
Browse files Browse the repository at this point in the history
This works around the fact that strings.Split() will never return an empty slice.
  • Loading branch information
attilaolah committed Jul 3, 2024
1 parent 5f64689 commit 9bdd00e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/github/sshkeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func fetchKeys(username string) ([]string, error) {
}

var keys []string
for _, line := range strings.Split(strings.TrimSpace(string(contents)), "\n") {
for _, line := range strings.FieldsFunc(strings.TrimSpace(string(contents)), func(r rune) bool { return r == '\n' }) {
keys = append(keys, strings.TrimSpace(line))
}

Expand Down

0 comments on commit 9bdd00e

Please sign in to comment.