From 98111aec8ddd70ca061c2954f3dddcc8817c1d44 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 13 Feb 2025 22:59:16 +0800 Subject: [PATCH] *.go: Reformat --- http_handle_repo_info.go | 2 +- http_server.go | 4 ++-- ssh_url_generation.go | 3 +-- diff --git a/http_handle_repo_info.go b/http_handle_repo_info.go index f5b9dfd5152cb7a2b20dd503c9a3bf26a6d3ff41..a994c34dcbf8bb0c82b8aa4935b952a39822e8cb 100644 --- a/http_handle_repo_info.go +++ b/http_handle_repo_info.go @@ -5,5 +5,5 @@ "net/http" ) func handle_repo_info(w http.ResponseWriter, r *http.Request, params map[string]any) { - http.Error(w, "\x1b[1;93mHi! We do not support Git operations over HTTP yet.\x1b[0m\n\x1b[1;93mMeanwhile, please use ssh by simply replacing the scheme with \"ssh://\":\x1b[0m\n\x1b[1;93m"+ generate_ssh_remote_url(params["group_name"].(string), params["repo_name"].(string)) + "\x1b[0m", http.StatusNotImplemented) + http.Error(w, "\x1b[1;93mHi! We do not support Git operations over HTTP yet.\x1b[0m\n\x1b[1;93mMeanwhile, please use ssh by simply replacing the scheme with \"ssh://\":\x1b[0m\n\x1b[1;93m"+generate_ssh_remote_url(params["group_name"].(string), params["repo_name"].(string))+"\x1b[0m", http.StatusNotImplemented) } diff --git a/http_server.go b/http_server.go index 0787ea97467901df354525126634516141ecd421..3804df77b4132b9442fce275727fcc607f28e616 100644 --- a/http_server.go +++ b/http_server.go @@ -7,8 +7,8 @@ "net/http" "strconv" "strings" - "go.lindenii.runxiyu.org/lindenii-common/clog" "github.com/jackc/pgx/v5" + "go.lindenii.runxiyu.org/lindenii-common/clog" ) type http_router_t struct{} @@ -49,7 +49,7 @@ } params := make(map[string]any) params["global"] = global_data - var _user_id int // 0 for none + var _user_id int // 0 for none _user_id, params["username"], err = get_user_info_from_request(r) if errors.Is(err, http.ErrNoCookie) { } else if errors.Is(err, pgx.ErrNoRows) { diff --git a/ssh_url_generation.go b/ssh_url_generation.go index 0cf4c1e722a532ad13664fe7ced73288bece3716..bdef57f4929797d7321c654fbbde063e3bf65269 100644 --- a/ssh_url_generation.go +++ b/ssh_url_generation.go @@ -6,6 +6,5 @@ "strings" ) func generate_ssh_remote_url(group_name, repo_name string) string { - return strings.TrimSuffix(config.SSH.Root, "/")+"/"+url.PathEscape(group_name)+"/:/repos/"+url.PathEscape(repo_name) + return strings.TrimSuffix(config.SSH.Root, "/") + "/" + url.PathEscape(group_name) + "/:/repos/" + url.PathEscape(repo_name) } - -- 2.48.1