From 0e7a7a68cd2a29895eae345ce56145b780d4a06c Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 5 May 2021 11:22:58 -0400 Subject: text/template/parse: rename DeferFuncCheck to SkipFuncCheck MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The proposal as accepted in #34652 named the bit SkipFuncCheck. It was renamed to DeferFuncCheck during the code review on a suggestion by Rob, along with a comment to “defer type checking functions until template is executed,” but this description is not accurate: the package has never type-checked functions, only verified their existence. And the effect of the bit in this package is to eliminate this check entirely, not to defer it to some later time. I was writing code using this new bit and was very confused about when the "type checking" was being deferred to and how to stop that entirely, since in my use case I wanted no checks at all. What I wanted is what the bit does, it just wasn't named accurately. Rename back to SkipFuncCheck. Change-Id: I8e62099c8a904ed04521eb5b86155290f6d5b12f Reviewed-on: https://go-review.googlesource.com/c/go/+/317269 Trust: Russ Cox Trust: Daniel Martí Run-TryBot: Russ Cox TryBot-Result: Go Bot Reviewed-by: Rob Pike --- src/text/template/parse/parse_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/text/template/parse/parse_test.go') diff --git a/src/text/template/parse/parse_test.go b/src/text/template/parse/parse_test.go index c4585f6912..9b1be272e5 100644 --- a/src/text/template/parse/parse_test.go +++ b/src/text/template/parse/parse_test.go @@ -379,12 +379,12 @@ func TestParseWithComments(t *testing.T) { } } -func TestDeferFuncCheck(t *testing.T) { +func TestSkipFuncCheck(t *testing.T) { oldTextFormat := textFormat textFormat = "%q" defer func() { textFormat = oldTextFormat }() - tr := New("defer func check") - tr.Mode = DeferFuncCheck + tr := New("skip func check") + tr.Mode = SkipFuncCheck tmpl, err := tr.Parse("{{fn 1 2}}", "", "", make(map[string]*Tree)) if err != nil { t.Fatalf("unexpected error: %v", err) -- cgit v1.3-5-g9baa