Standard library / text/template

text/template.ExecError.Unwrap()

Returns the underlying evaluation error. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (e ExecError) Unwrap() error

Return Value

error

Parsing or setting error; nil on success.

Working Example

Example Snippetgo
package main
import (  "errors"  "fmt"  "text/template")
func main() {  cause := errors.New("demo failure")  e := template.ExecError{Name: "x", Err: cause}  fmt.Println(errors.Is(e, cause))}
Go Reference