diff options
author | Runxi Yu <me@runxiyu.org> | 2025-02-15 10:23:08 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-02-15 10:23:08 +0800 |
commit | 3aae548374b0ca19b9e14c30a1ca6790251cc1db (patch) | |
tree | ef6b63bf7e8ed959a665213683d44e08287d30f5 | |
parent | {http_server,url}.go: Fix redirects (diff) | |
download | forge-3aae548374b0ca19b9e14c30a1ca6790251cc1db.tar.gz forge-3aae548374b0ca19b9e14c30a1ca6790251cc1db.tar.zst forge-3aae548374b0ca19b9e14c30a1ca6790251cc1db.zip |
*.go: Reformat
-rw-r--r-- | http_handle_repo_commit.go | 2 | ||||
-rw-r--r-- | http_server.go | 8 | ||||
-rw-r--r-- | ssh_server.go | 2 | ||||
-rw-r--r-- | url.go | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/http_handle_repo_commit.go b/http_handle_repo_commit.go index 8e5cdbf..0eb6bb4 100644 --- a/http_handle_repo_commit.go +++ b/http_handle_repo_commit.go @@ -76,7 +76,7 @@ func handle_repo_commit(w http.ResponseWriter, r *http.Request, params map[strin to = fake_diff_file_null } chunks := []usable_chunk{} - for _, chunk := range file_patch.Chunks() { + for _, chunk := range file_patch.Chunks() { content := chunk.Content() if len(content) > 0 && content[0] == '\n' { content = "\n" + content diff --git a/http_server.go b/http_server.go index e830fb1..ffbb711 100644 --- a/http_server.go +++ b/http_server.go @@ -122,9 +122,9 @@ func (router *http_router_t) ServeHTTP(w http.ResponseWriter, r *http.Request) { } // TODO: subgroups if non_empty_last_segments_len == separator_index+3 { - if redirect_with_slash(w, r) { - return - } + if redirect_with_slash(w, r) { + return + } handle_repo_index(w, r, params) return } @@ -135,7 +135,7 @@ func (router *http_router_t) ServeHTTP(w http.ResponseWriter, r *http.Request) { case "tree": params["rest"] = strings.Join(segments[separator_index+4:], "/") if len(segments) < separator_index+5 && redirect_with_slash(w, r) { - return + return } handle_repo_tree(w, r, params) case "raw": diff --git a/ssh_server.go b/ssh_server.go index 70767aa..0dde4b4 100644 --- a/ssh_server.go +++ b/ssh_server.go @@ -42,7 +42,7 @@ func serve_ssh(listener net.Listener) error { } clog.Info("Incoming SSH: " + session.RemoteAddr().String() + " " + strings.TrimSuffix(client_public_key_string, "\n") + " " + session.RawCommand()) - fmt.Fprintln(session.Stderr(), "Lindenii Forge " + VERSION + ", source at " + strings.TrimSuffix(config.HTTP.Root, "/") + "/:/source/\r") + fmt.Fprintln(session.Stderr(), "Lindenii Forge "+VERSION+", source at "+strings.TrimSuffix(config.HTTP.Root, "/")+"/:/source/\r") cmd := session.Command() @@ -11,7 +11,7 @@ import ( var ( err_duplicate_ref_spec = errors.New("Duplicate ref spec") - err_no_ref_spec = errors.New("No ref spec") + err_no_ref_spec = errors.New("No ref spec") ) func get_param_ref_and_type(r *http.Request) (ref_type, ref string, err error) { |