aboutsummaryrefslogtreecommitdiff
path: root/lib/text/chunk.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2026-04-05 03:50:32 +0700
committerShulhan <ms@kilabit.info>2026-04-05 03:52:47 +0700
commit778fd16011ec1d39c41b62372dc65f045183266e (patch)
treea6f6f26930c00d8ac3dd7bfa1fb476bd65454833 /lib/text/chunk.go
parent6fba7b9ce3bcaf4225e5ab774a15ef7364ed1420 (diff)
downloadpakakeh.go-778fd16011ec1d39c41b62372dc65f045183266e.tar.xz
all: apply go fix
Diffstat (limited to 'lib/text/chunk.go')
-rw-r--r--lib/text/chunk.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/text/chunk.go b/lib/text/chunk.go
index a904f2bd..10d37936 100644
--- a/lib/text/chunk.go
+++ b/lib/text/chunk.go
@@ -8,6 +8,7 @@ import (
"bytes"
"fmt"
"strconv"
+ "strings"
)
// Chunk represent subset of line, contain starting position and slice of
@@ -20,15 +21,15 @@ type Chunk struct {
// JoinChunks all chunk's values using `sep` as separator and return it as
// string.
func JoinChunks(chunks []Chunk, sep string) string {
- var out string
+ var out strings.Builder
for x := range len(chunks) {
if x > 0 {
- out += sep
+ out.WriteString(sep)
}
- out += string(chunks[x].V)
+ out.WriteString(string(chunks[x].V))
}
- return out
+ return out.String()
}
// MarshalJSON encode the Chunk into JSON value.