From 98826d198b228e725ceb5a9fcf1d936ad3817d8e Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 5 Apr 2025 14:09:15 +0800 Subject: Reduce unnecessary allocations when converting []byte to string --- http_handle_repo_index.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'http_handle_repo_index.go') diff --git a/http_handle_repo_index.go b/http_handle_repo_index.go index b0a5899..8f0a62b 100644 --- a/http_handle_repo_index.go +++ b/http_handle_repo_index.go @@ -91,10 +91,10 @@ func httpHandleRepoIndex(w http.ResponseWriter, req *http.Request, params map[st commits = append(commits, commitDisplay{ Hash: hex.EncodeToString(id), - Author: string(authorName), - Email: string(authorEmail), - Date: string(authorDate), - Message: string(title), + Author: bytesToString(authorName), + Email: bytesToString(authorEmail), + Date: bytesToString(authorDate), + Message: bytesToString(title), }) } -- cgit v1.2.3