Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tv42 opened this issue Dec 23, 2014 · 0 comments
Closed

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

tv42 opened this issue Dec 23, 2014 · 0 comments
Milestone

Comments

@tv42
Copy link

tv42 commented Dec 23, 2014

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)
    }

}
@mikioh mikioh added this to the Go1.5 milestone Mar 16, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
@rsc rsc unassigned robpike Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants