Standard library / runtime

runtime.Error

Interface implemented by runtime-generated errors; includes error and RuntimeError marker. Not every panic value implements it. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
type Error interface {  error
  RuntimeError()}

Working Example

Example Snippetgo
package main
import (  "fmt"  "runtime")
func main() {  func() {    defer func() { _, ok := recover().(runtime.Error); fmt.Println(ok) }()    var x any = 42    _ = x.(string)  }()}
Go Reference