go/src/html/template
Ian Lance Taylor 496d7c6914 text/template: add lock for Template.tmpl to fix data race
This adds a new lock protecting "tmpl".

This is a copy of https://golang.org/cl/257817 by Andreas Fleig,
updated for current tip, and updated to start running the
html/template TestEscapeRace test.

Thanks to @bep for providing the test case.

Fixes #39807

Change-Id: Ic8874484290283a49116812eeaffb8608346dc70
Reviewed-on: https://go-review.googlesource.com/c/go/+/316669
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-05-04 00:03:39 +00:00
..
testdata html/template, text/template: add ParseFS 2020-10-20 18:41:14 +00:00
attr.go
attr_string.go
clone_test.go all: update references to symbols moved from io/ioutil to io 2020-10-20 18:41:18 +00:00
content.go
content_test.go
context.go
css.go
css_test.go
delim_string.go
doc.go
element_string.go
error.go
escape.go text/template: add CommentNode to template parse tree 2020-08-28 21:45:12 +00:00
escape_test.go encoding/json: revert "add "json: " prefix to SyntaxError messages" 2020-12-01 22:51:45 +00:00
example_test.go
examplefiles_test.go all: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTemp 2020-12-09 19:12:23 +00:00
exec_test.go text/template: add lock for Template.tmpl to fix data race 2021-05-04 00:03:39 +00:00
html.go
html_test.go
js.go
js_test.go
jsctx_string.go
multi_test.go html/template, text/template: add ParseFS 2020-10-20 18:41:14 +00:00
state_string.go
template.go html/template: revert "avoid race when escaping updates template" 2021-01-25 20:41:05 +00:00
template_test.go text/template: add CommentNode to template parse tree 2020-08-28 21:45:12 +00:00
transition.go
transition_test.go
url.go
url_test.go
urlpart_string.go