From a4e7599e72847f00fffc9279a8f1196e70d374a3 Mon Sep 17 00:00:00 2001 From: Stefano Scafiti Date: Sat, 13 Apr 2024 08:12:28 +0200 Subject: [PATCH] Add reference implementation --- pkg/helpers/slices/slices.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/helpers/slices/slices.go b/pkg/helpers/slices/slices.go index 81608363c4..a8ccc82ac6 100644 --- a/pkg/helpers/slices/slices.go +++ b/pkg/helpers/slices/slices.go @@ -7,6 +7,7 @@ import ( // BytesToString converts bytes to a string without memory allocation. // NOTE: The given bytes MUST NOT be modified since they share the same backing array // with the returned string. +// Reference implementation: https://github.com/golang/go/blob/ad7c32dc3b6d5edc3dd72b3e15c80dc4f4c27064/src/strings/builder.go#L47. func BytesToString(bs []byte) string { return *(*string)(unsafe.Pointer(&bs)) }