diff options
author | Runxi Yu <me@runxiyu.org> | 2025-04-05 14:07:58 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-04-05 14:07:58 +0800 |
commit | 320d25d2c43929ddcc25cb22979bbdd3aaffd3b7 (patch) | |
tree | f9f95697e5eb227016f0b99ffeb76f392e06d222 /http_handle_repo_raw.go | |
parent | CSS: Add margin-bottom on footer (diff) | |
download | forge-320d25d2c43929ddcc25cb22979bbdd3aaffd3b7.tar.gz forge-320d25d2c43929ddcc25cb22979bbdd3aaffd3b7.tar.zst forge-320d25d2c43929ddcc25cb22979bbdd3aaffd3b7.zip |
Reduce allocations when converting string to []byte
Diffstat (limited to 'http_handle_repo_raw.go')
-rw-r--r-- | http_handle_repo_raw.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/http_handle_repo_raw.go b/http_handle_repo_raw.go index 8a9740e..5c8f626 100644 --- a/http_handle_repo_raw.go +++ b/http_handle_repo_raw.go @@ -36,7 +36,7 @@ func httpHandleRepoRaw(writer http.ResponseWriter, request *http.Request, params brWriter := bare.NewWriter(conn) brReader := bare.NewReader(conn) - if err := brWriter.WriteData([]byte(repoPath)); err != nil { + if err := brWriter.WriteData(stringToBytes(repoPath)); err != nil { errorPage500(writer, params, "sending repo path failed: "+err.Error()) return } @@ -44,7 +44,7 @@ func httpHandleRepoRaw(writer http.ResponseWriter, request *http.Request, params errorPage500(writer, params, "sending command failed: "+err.Error()) return } - if err := brWriter.WriteData([]byte(pathSpec)); err != nil { + if err := brWriter.WriteData(stringToBytes(pathSpec)); err != nil { errorPage500(writer, params, "sending path failed: "+err.Error()) return } |