unsafe.go (264B)
1 // +build !appengine 2 3 package bunotel 4 5 import "unsafe" 6 7 func bytesToString(b []byte) string { 8 return *(*string)(unsafe.Pointer(&b)) 9 } 10 11 func stringToBytes(s string) []byte { 12 return *(*[]byte)(unsafe.Pointer( 13 &struct { 14 string 15 Cap int 16 }{s, len(s)}, 17 )) 18 }