(s string)
| 34 | } |
| 35 | |
| 36 | func StringToBytes(s string) []byte { |
| 37 | b := make([]byte, 0, 0) |
| 38 | bh := (*reflect.SliceHeader)(unsafe.Pointer(&b)) |
| 39 | sh := (*reflect.StringHeader)(unsafe.Pointer(&s)) |
| 40 | bh.Data = sh.Data |
| 41 | bh.Cap = sh.Len |
| 42 | bh.Len = sh.Len |
| 43 | runtime.KeepAlive(s) |
| 44 | return b |
| 45 | } |
nothing calls this directly
no outgoing calls
no test coverage detected