refactor(git): swap if-else chain for switch statement

Amolith created

Change summary

git/git.go | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

Detailed changes

git/git.go 🔗

@@ -177,10 +177,12 @@ func stringifyRepo(url string) (string, error) {
 		return "", err
 	}
 
-	if ep.Protocol == "http" || ep.Protocol == "https" {
+	switch ep.Protocol {
+	case "http", "https":
 		return "data/" + strings.Split(url, "://")[1], nil
-	} else if ep.Protocol == "ssh" {
+	case "ssh":
 		return "data/" + ep.Host + "/" + ep.Path, nil
+	default:
+		return "", errors.New("unsupported protocol")
 	}
-	return "", errors.New("unsupported protocol")
 }