-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
html/template: Parse overrides templates with empty templates #19204
Comments
One other important point on this issue is that the behavior is not consistent. I ran into this same issue separately and made this example: https://play.golang.org/p/mpBOEdhkFR Both playground examples exhibit different behavior if you open it, add a space somewhere (to force a cache miss), and hit run again. Do that about 10-20 times and you should get at least one or two times where it produces a different result. Some sort of race condition happening here. I also verified my example works correctly on go 1.7.5 and exhibits the buggy behavior described with the go 1.8 download. |
This has been fixed by recent changes, most likely https://go-review.googlesource.com/c/38420/ (soon to be submitted). |
CL https://golang.org/cl/38420 mentions this issue. |
CL https://golang.org/cl/39594 mentions this issue. |
This was a subtle bug introduced in the previous release's fix for issue 16156. The definition of empty template was broken, causing the answer to depend on the order of templates in the map. Fixes #16156 (for real). Fixes #19294. Fixes #19204. Change-Id: I1cd915c94534cad3116d83bd158cbc28700510b9 Reviewed-on: https://go-review.googlesource.com/38420 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-on: https://go-review.googlesource.com/39594 Reviewed-by: Rob Pike <r@golang.org>
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.8
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ddrboxman/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/hf/vcfpg1rd77qdcxmt5dwqr2nw0000gn/T/go-build688954702=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
What did you do?
https://play.golang.org/p/xsexXsdE5x
What did you expect to see?
2009/11/10 23:00:00
placeholder
What did you see instead?
2009/11/10 23:00:00
Other Info
https://golang.org/pkg/html/template/#Template.Parse
"A template definition with a body containing only white space and comments is considered empty and will not replace an existing template's body"
The text was updated successfully, but these errors were encountered: