diff --git a/pkg/github/sshkeys.go b/pkg/github/sshkeys.go index f7baf25..6a39e06 100644 --- a/pkg/github/sshkeys.go +++ b/pkg/github/sshkeys.go @@ -23,6 +23,11 @@ func ResolveSSHKeys(ctx context.Context, usernames []string) (map[string][]strin return nil, fmt.Errorf("failed to fetch SSH keys for GitHub user %q: %w", username, err) } + if len(keys) == 0 { + zerolog.Ctx(ctx).Warn().Str("username", username).Dur("took", time.Since(t)).Msg("No keys found") + continue + } + m[username] = keys zerolog.Ctx(ctx).Info().Str("username", username).Dur("took", time.Since(t)).Msg("Resolved keys") @@ -47,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)) }