Skip to content

text/template: panics on nil pointer deference from {{nil.Bork}} #9426

@tv42

Description

@tv42

I expected an error, not a panic. text/template docs do not mention Execute panicing.

http://play.golang.org/p/Ul3-jwOA0x

package main

import (
    "log"
    "os"
    "text/template"
)

func main() {
    const input = `{{nil.Bork}}`
    t := template.Must(template.New("letter").Parse(input))
    err := t.Execute(os.Stdout, nil)
    if err != nil {
        log.Println("executing template:", err)
    }

}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions