From 360cd7bdc721c2aa968e2f6888db1c7e36538ae2 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Wed, 22 Jan 2025 21:33:10 +0700 Subject: lib/bytes: replace Copy and Concat with standard library Since Go 1.20, the standard bytes package have the Copy function. Since Go 1.22, the standard slices package have the Concat function. --- lib/bytes/bytes.go | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'lib/bytes/bytes.go') diff --git a/lib/bytes/bytes.go b/lib/bytes/bytes.go index 3bbf529b..76bb7874 100644 --- a/lib/bytes/bytes.go +++ b/lib/bytes/bytes.go @@ -71,31 +71,6 @@ func AppendUint64(data []byte, v uint64) []byte { return data } -// Concat merge one or more []byte or string in args into slice of -// byte. -// Any type that is not []byte or string in args will be ignored. -func Concat(args ...interface{}) (out []byte) { - for _, arg := range args { - switch v := arg.(type) { - case string: - out = append(out, []byte(v)...) - case []byte: - out = append(out, v...) - } - } - return out -} - -// Copy slice of bytes from parameter. -func Copy(src []byte) (dst []byte) { - if len(src) == 0 { - return - } - dst = make([]byte, len(src)) - copy(dst, src) - return -} - // CutUntilToken cut text until we found token. // // If token found, it will return all bytes before token, position of byte -- cgit v1.3