Standard library / runtime
runtime.TypeAssertionError.RuntimeError()
Marker for runtime.Error. The example obtains an actual failed assertion before calling the marker. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (*TypeAssertionError) RuntimeError()Working Example
Example Snippetgo
package main
import ( "fmt" "runtime")
func main() { func() { defer func() { e, ok := recover().(*runtime.TypeAssertionError) if !ok { panic("unexpected") } e.RuntimeError() fmt.Println(e.Error() != "") }() var x any = 42 _ = x.(string) }()}