aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-30 19:09:45 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-30 19:09:45 +0800
commitf62dd51945729f58e542892cbab8326bbed07467 (patch)
treed410bbeb719ae918abb8ffa271f2e0cf94226eb9
parentFix tabs look (diff)
downloadforge-f62dd51945729f58e542892cbab8326bbed07467.tar.gz
forge-f62dd51945729f58e542892cbab8326bbed07467.tar.zst
forge-f62dd51945729f58e542892cbab8326bbed07467.zip
Use unsafe.SliceData instead of &b[0]
-rw-r--r--unsafe.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/unsafe.go b/unsafe.go
index 418a910..81c1808 100644
--- a/unsafe.go
+++ b/unsafe.go
@@ -16,5 +16,5 @@ func stringToBytes(s string) (bytes []byte) {
// 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))
}