Igor Sirotin 679391999f
feat_: LogOnPanic linter (#5969)
* feat_: LogOnPanic linter

* fix_: add missing defer LogOnPanic

* chore_: make vendor

* fix_: tests, address pr comments

* fix_: address pr comments
2024-10-23 21:33:05 +01:00

21 lines
337 B
Go

package unsafebytes
import "unsafe"
func Pointer(b []byte) *byte {
return *(**byte)(unsafe.Pointer(&b))
}
func String(b []byte) string {
return *(*string)(unsafe.Pointer(&b))
}
func BytesOf(s string) []byte {
return *(*[]byte)(unsafe.Pointer(&sliceHeader{str: s, cap: len(s)}))
}
type sliceHeader struct {
str string
cap int
}