Skip to content

Instantly share code, notes, and snippets.

@zboralski
Created March 5, 2023 13:08
Show Gist options
  • Save zboralski/07ac259e82c0ee00bf7a3deb3435afae to your computer and use it in GitHub Desktop.
Save zboralski/07ac259e82c0ee00bf7a3deb3435afae to your computer and use it in GitHub Desktop.
no-copy conversion from []byte to string #25484
// no-copy conversion from []byte to string #25484
// https://github.com/golang/go/issues/25484#issuecomment-391415660
func ByteSlice2String(bs []byte) string {
return *(*string)(unsafe.Pointer(&bs))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment