From f62dd51945729f58e542892cbab8326bbed07467 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 30 Mar 2025 19:09:45 +0800 Subject: [PATCH] Use unsafe.SliceData instead of &b[0] --- unsafe.go | 2 +- diff --git a/unsafe.go b/unsafe.go index 418a910409520b0f4abcf2f11c87819412765843..81c1808e726ff82faa02066843321d574f9d7ba1 100644 --- a/unsafe.go +++ b/unsafe.go @@ -16,5 +16,5 @@ // bytesToString converts a byte slice to a string without copying the bytes. // Memory is borrowed from the byte slice. // The source byte slice must not be modified. func bytesToString(b []byte) string { - return unsafe.String(&b[0], len(b)) + return unsafe.String(unsafe.SliceData(b), len(b)) } -- 2.48.1