aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-13 22:59:16 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-13 22:59:16 +0800
commit98111aec8ddd70ca061c2954f3dddcc8817c1d44 (patch)
treedf73ab1ad11f670c4d68590492bba4d1fced87b5
parenthttp_{server,handle_login}.go: Fix missing error handling (diff)
downloadforge-98111aec8ddd70ca061c2954f3dddcc8817c1d44.tar.gz
forge-98111aec8ddd70ca061c2954f3dddcc8817c1d44.tar.zst
forge-98111aec8ddd70ca061c2954f3dddcc8817c1d44.zip
*.go: Reformat
-rw-r--r--http_handle_repo_info.go2
-rw-r--r--http_server.go4
-rw-r--r--ssh_url_generation.go3
3 files changed, 4 insertions, 5 deletions
diff --git a/http_handle_repo_info.go b/http_handle_repo_info.go
index f5b9dfd..a994c34 100644
--- a/http_handle_repo_info.go
+++ b/http_handle_repo_info.go
@@ -5,5 +5,5 @@ import (
)
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 0787ea9..3804df7 100644
--- a/http_server.go
+++ b/http_server.go
@@ -7,8 +7,8 @@ import (
"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 @@ func (router *http_router_t) ServeHTTP(w http.ResponseWriter, r *http.Request) {
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 0cf4c1e..bdef57f 100644
--- a/ssh_url_generation.go
+++ b/ssh_url_generation.go
@@ -6,6 +6,5 @@ import (
)
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)
}
-