diff options
author | Runxi Yu <me@runxiyu.org> | 2025-03-30 19:09:45 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-03-30 19:09:45 +0800 |
commit | f62dd51945729f58e542892cbab8326bbed07467 (patch) | |
tree | d410bbeb719ae918abb8ffa271f2e0cf94226eb9 | |
parent | Fix tabs look (diff) | |
download | forge-f62dd51945729f58e542892cbab8326bbed07467.tar.gz forge-f62dd51945729f58e542892cbab8326bbed07467.tar.zst forge-f62dd51945729f58e542892cbab8326bbed07467.zip |
Use unsafe.SliceData instead of &b[0]
-rw-r--r-- | unsafe.go | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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)) } |