1 2 3 4 5 6 7 8 9 10 11
package irc import "unsafe" func bytesToString(bytes []byte) (s string) { return unsafe.String(unsafe.SliceData(bytes), len(bytes)) } func stringToBytes(s string) (bytes []byte) { return unsafe.Slice(unsafe.StringData(s), len(s)) }