Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(337)

Issue 5656059: code review 5656059: text/template: evaluate function fields (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 3 months ago by r
Modified:
13 years, 3 months ago
Reviewers:
rsc, r2
CC:
golang-dev, dsymonds
Visibility:
Public.

Description

text/template: evaluate function fields Just an oversight they didn't work and easy to address. Fixes issue 3025.

Patch Set 1 #

Patch Set 2 : diff -r 24eea06cea11 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 07abe73c41ce https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+15 lines, -3 lines) Patch
M src/pkg/text/template/exec.go View 1 1 chunk +7 lines, -3 lines 0 comments Download
M src/pkg/text/template/exec_test.go View 3 chunks +8 lines, -0 lines 0 comments Download

Messages

Total messages: 5
r
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 3 months ago (2012-02-15 04:36:22 UTC) #1
dsymonds
LGTM
13 years, 3 months ago (2012-02-15 05:04:07 UTC) #2
r
*** Submitted as http://code.google.com/p/go/source/detail?r=a50806fa9040 *** text/template: evaluate function fields Just an oversight they didn't work ...
13 years, 3 months ago (2012-02-15 05:05:41 UTC) #3
rsc
This broke the go command's usage message. It was using {{if .Run}} to test whether ...
13 years, 3 months ago (2012-02-15 14:06:33 UTC) #4
r2
13 years, 3 months ago (2012-02-15 23:26:58 UTC) #5
On Feb 16, 2012, at 1:06 AM, Russ Cox wrote:

> This broke the go command's usage message.
> It was using {{if .Run}} to test whether the field
> was != nil, and now template wants to execute
> the function.
> 
> I don't have a good solution.

i think the new behavior is what most would expect, which is unfortunate in this
instance.
in your case, a boolean method that checks p.Run == nil would solve it. i'll
send a CL.
i could make nil functions be false in the template package, but that would be
hacky and surprising.

-rob

Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b