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:
authorJacob Vosmaer <jacob@gitlab.com>2019-03-20 23:19:00 +0300
committerPaul Okstad <pokstad@gitlab.com>2019-03-20 23:19:00 +0300
commit996ac5da5c8cf5de7cb364e07aae49d81eb5eef2 (patch)
treef4892136fb060e041f8baf013a0360c6b9d3edd8 /internal/helper/text
parentf309a06e14740430380f96f5d2e212b525ca63cf (diff)
Introduce text.ChompBytes helper
Diffstat (limited to 'internal/helper/text')
-rw-r--r--internal/helper/text/chomp.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/helper/text/chomp.go b/internal/helper/text/chomp.go
new file mode 100644
index 000000000..6ce64cafa
--- /dev/null
+++ b/internal/helper/text/chomp.go
@@ -0,0 +1,8 @@
+package text
+
+import "strings"
+
+// ChompBytes converts b to a string with its trailing newline, if present, removed.
+func ChompBytes(b []byte) string {
+ return strings.TrimSuffix(string(b), "\n")
+}