Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-06-22 12:42:51 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-06-22 12:42:51 +0300
commit8fbd69cb1f0ed57f933afb62dbe11c0c79327458 (patch)
treed48cf95134d3999082a2c0e5f25149ca4343ffcf
parentc31b039fa518dd329984c20f3a4961f9946490a4 (diff)
parent3593199ec13b9b96e714b85d05a06162c610315b (diff)
Merge branch 'ash2k/optimize-chomp' into 'master'
Optimize ChompBytes() function See merge request gitlab-org/gitaly!4659
-rw-r--r--internal/helper/text/chomp.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/helper/text/chomp.go b/internal/helper/text/chomp.go
index 6ce64cafa..bfc692a79 100644
--- a/internal/helper/text/chomp.go
+++ b/internal/helper/text/chomp.go
@@ -1,8 +1,10 @@
package text
-import "strings"
+import (
+ "bytes"
+)
// ChompBytes converts b to a string with its trailing newline, if present, removed.
func ChompBytes(b []byte) string {
- return strings.TrimSuffix(string(b), "\n")
+ return string(bytes.TrimSuffix(b, []byte{'\n'}))
}