12 lines
203 B
Go
12 lines
203 B
Go
//go:build go1.20
|
|
|
|
package utils
|
|
|
|
import (
|
|
"unsafe"
|
|
)
|
|
|
|
// UnsafeBytes returns a byte pointer without allocation.
|
|
func UnsafeBytes(s string) []byte {
|
|
return unsafe.Slice(unsafe.StringData(s), len(s))
|
|
}
|