From ad7779d934e177d4e94ce6c5f83075278450912a Mon Sep 17 00:00:00 2001 From: hopehook Date: Wed, 8 Feb 2023 17:40:59 +0800 Subject: [PATCH] chore: add reference documentation link to comment of code --- internal/bytesconv/bytesconv_1.20.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/bytesconv/bytesconv_1.20.go b/internal/bytesconv/bytesconv_1.20.go index 93879468..7c1cae12 100644 --- a/internal/bytesconv/bytesconv_1.20.go +++ b/internal/bytesconv/bytesconv_1.20.go @@ -12,11 +12,13 @@ import ( ) // StringToBytes converts string to byte slice without a memory allocation. +// For more details, see https://github.com/golang/go/issues/53003#issuecomment-1140276077. func StringToBytes(s string) []byte { return unsafe.Slice(unsafe.StringData(s), len(s)) } // BytesToString converts byte slice to string without a memory allocation. +// For more details, see https://github.com/golang/go/issues/53003#issuecomment-1140276077. func BytesToString(b []byte) string { return unsafe.String(unsafe.SliceData(b), len(b)) }