]> Cypherpunks.ru repositories - gostls13.git/commit
text/template/parse: fix data race on lexer initialization
authorEli Bendersky <eliben@golang.org>
Sat, 4 Jun 2022 16:43:40 +0000 (09:43 -0700)
committerEli Bendersky‎ <eliben@golang.org>
Mon, 6 Jun 2022 15:54:07 +0000 (15:54 +0000)
commit9ce28b518d9a792d2e3e741bcb38fa046891906e
treed3aebab799e2ddfbb575b129e9193c9cfbf72ce7
parent47e34ca533b118bd47061b15fc7918563f4837a7
text/template/parse: fix data race on lexer initialization

Before this change, `startParse` would write `lex.breakOK` and `lex.continueOK` when the lexer goroutine is already running, which is a potential race condition.

Makes `breakOK` and `continueOK` configuration flags passed when `lexer` is created, similarly to how `emitComment` works.

Fixes #53234

Change-Id: Ia65f6135509a758cd4c5a453b249a174f4fb3e21
Reviewed-on: https://go-review.googlesource.com/c/go/+/410414
Reviewed-by: Eli Bendersky <eliben@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
src/text/template/parse/lex.go
src/text/template/parse/lex_test.go
src/text/template/parse/parse.go