Skip to content

Commit

Permalink
remove switch/case
Browse files Browse the repository at this point in the history
  • Loading branch information
mightyguava committed Sep 30, 2022
1 parent 1841f0b commit b84d597
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions api/internal/git/repospec.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,14 @@ func normalizeGitHostSpec(host string) (string, error) {
s := strings.ToLower(host)
m := userRegex.FindStringSubmatch(host)
if strings.Contains(s, "github.com") {
switch {
case len(m) > 0:
if len(m) > 0 {
if strings.HasPrefix(s, "git::") && m[1] != "git@" {
return "", fmt.Errorf("git protocol on github.com only allows git@ user")
}
host = m[1] + "github.com:"
case strings.Contains(s, "ssh:"):
} else if strings.Contains(s, "ssh:") {
host = "[email protected]:"
default:
} else {
host = "https://github.com/"
}
}
Expand Down

0 comments on commit b84d597

Please sign in to comment.