UnsafeString converts a byte slice to a string without copying the underlying data. Unsafe string coversion is OK when calling some other function that doesn't store the string and otherwise never uses the string again.
(b []byte)
| 12 | // data. Unsafe string coversion is OK when calling some other function that |
| 13 | // doesn't store the string and otherwise never uses the string again. |
| 14 | func UnsafeString(b []byte) string { |
| 15 | return *(*string)(unsafe.Pointer(&b)) |
| 16 | } |
| 17 | |
| 18 | func ParseBool(b []byte) (bool, error) { |
| 19 | return strconv.ParseBool(UnsafeString(b)) |
no outgoing calls
no test coverage detected