Documentation
¶
Overview ¶
Package runsafe contains things that leverage the unsafe builtin package. Its contents should be treated as experimental and unstable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBytes ¶ added in v0.6.0
GetBytes returns the underlying byte slice of the given string mutations to the returned byte slice will affect the string, which breaks string immutability source: https://groups.google.com/g/golang-nuts/c/Zsfk-VMd_fU/m/O1ru4fO-BgAJ
func RecoverCtx ¶
RecoverCtx returns (from the bottom up) the first context that's encountered in the callstack it stops the current goroutine to build a stacktrace, walks up the stack to find contexts, and returns the first one if no context is encountered, an empty context and an UnrecoverableContext Error are returned this is not guaranteed to work: many things can go wrong, chief among them is that inlined functions elide their parameter memory addresses see https://dave.cheney.net/2019/12/08/dynamically-scoped-variables-in-go for a more thorough explanation on how this works
Types ¶
type UnrecoverableContext ¶
type UnrecoverableContext struct{}
UnrecoverableContext is an error indicating that the context could not be dynamically recovered
func (UnrecoverableContext) Error ¶
func (UnrecoverableContext) Error() string
Source Files
¶
- context.go
- string.go