aboutsummaryrefslogtreecommitdiff
path: root/forged/internal/common/misc/unsafe.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-08-12 11:01:07 +0800
committerRunxi Yu <me@runxiyu.org>2025-09-26 17:25:37 +0800
commite238ccb06b05e88ec323ca95ad4600bd79743372 (patch)
tree46f82d4d0f4ec43e94dcde5677de1ba857862638 /forged/internal/common/misc/unsafe.go
parentRemove forge-specific functions from misc (diff)
downloadforge-master.tar.gz
forge-master.tar.zst
forge-master.zip
RefactorHEADmaster
Diffstat (limited to '')
-rw-r--r--forged/internal/common/misc/unsafe.go (renamed from forged/internal/misc/unsafe.go)4
1 files changed, 2 insertions, 2 deletions
diff --git a/forged/internal/misc/unsafe.go b/forged/internal/common/misc/unsafe.go
index 6c2192f..d827e7f 100644
--- a/forged/internal/misc/unsafe.go
+++ b/forged/internal/common/misc/unsafe.go
@@ -9,12 +9,12 @@ import "unsafe"
// Memory is borrowed from the string.
// The resulting byte slice must not be modified in any form.
func StringToBytes(s string) (bytes []byte) {
- return unsafe.Slice(unsafe.StringData(s), len(s))
+ return unsafe.Slice(unsafe.StringData(s), len(s)) //#nosec G103
}
// 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(unsafe.SliceData(b), len(b))
+ return unsafe.String(unsafe.SliceData(b), len(b)) //#nosec G103
}