Documentation ¶
Overview ¶
Package gohacks contains utilities for subverting the Go compiler.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImmutableBytesFromString ¶
ImmutableBytesFromString is equivalent to []byte(s), except that it uses the same memory backing s instead of making a heap-allocated copy. This is only valid if the returned slice is never mutated.
func Noescape ¶
Noescape hides a pointer from escape analysis. Noescape is the identity function but escape analysis doesn't think the output depends on the input. Noescape is inlined and currently compiles down to zero instructions. USE CAREFULLY!
(Noescape is copy/pasted from Go's runtime/stubs.go:noescape().)
func StringFromImmutableBytes ¶
StringFromImmutableBytes is equivalent to string(bs), except that it uses the same memory backing bs instead of making a heap-allocated copy. This is only valid if bs is never mutated after StringFromImmutableBytes returns.
Types ¶
This section is empty.