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: calling .Parse on an uninitialized template panics #11226

mwhudson opened this issue Jun 15, 2015 · 2 comments

text/template: calling .Parse on an uninitialized template panics #11226

mwhudson opened this issue Jun 15, 2015 · 2 comments


Copy link

@mwhudson mwhudson commented Jun 15, 2015

I found this in the tests of an old version of go.crypto:

mwhudson@glamdring:~$ cat repro.go
package main

import "text/template"

var tmpl template.Template

func main() {
mwhudson@glamdring:~$ go version
go version devel +348f191 Tue Jun 16 10:43:54 2015 +1200 linux/amd64
mwhudson@glamdring:~$ go run repro.go
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x468f41]

goroutine 1 [running]:
text/template.(*Template).Parse(0x642a60, 0x0, 0x0, 0x7f8a9d0d00a8, 0x0, 0x0)
    /opt/opensource/go/src/text/template/template.go:180 +0x361
    /home/mwhudson/repro.go:8 +0x2f
exit status 2
mwhudson@glamdring:~$ ~/go1.4/bin/go run repro.go
Copy link

@dspezia dspezia commented Jun 18, 2015

It fails trying to lock the mutex added by, but this is actually a consequence of ...
The behavior has clearly changed, but is calling Parse on a uninitialized Template legit?

Copy link
Contributor Author

@mwhudson mwhudson commented Jun 24, 2015

See #11379

@mwhudson mwhudson closed this Jun 24, 2015
@mikioh mikioh added this to the Go1.5 milestone Jun 24, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.