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

Issue 5415060: code review 5415060: text/template: new, simpler API (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:
CC:
dsymonds, adg, rsc, r2, gri, MikeSamuel, nigeltao, golang-dev
Visibility:
Public.

Description

text/template: new, simpler API The Set type is gone. Instead, templates are automatically associated by being parsed together; nested definitions implicitly create associations. Only associated templates can invoke one another. This approach dramatically reduces the breadth of the construction API. For now, html/template is deleted from src/pkg/Makefile, so this can be checked in. Nothing in the tree depends on it. It will be updated next.

Patch Set 1 #

Total comments: 17

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

Total comments: 6

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

Patch Set 4 : diff -r fd80a4497037 https://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 5 : diff -r fd80a4497037 https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r fd80a4497037 https://go.googlecode.com/hg/ #

Patch Set 7 : diff -r fd80a4497037 https://go.googlecode.com/hg/ #

Total comments: 11

Patch Set 8 : diff -r 5641d1093e82 https://go.googlecode.com/hg/ #

Patch Set 9 : diff -r 5641d1093e82 https://go.googlecode.com/hg/ #

Total comments: 6

Patch Set 10 : diff -r 5641d1093e82 https://go.googlecode.com/hg/ #

Patch Set 11 : diff -r 75348d679279 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+500 lines, -582 lines) Patch
M doc/codelab/wiki/final.go View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M doc/codelab/wiki/final-noclosure.go View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M doc/codelab/wiki/final-noerror.go View 1 2 3 4 5 6 7 1 chunk +2 lines, -2 lines 0 comments Download
M doc/codelab/wiki/final-parsetemplate.go View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M doc/codelab/wiki/final-template.go View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M doc/codelab/wiki/index.html View 1 2 3 4 5 6 7 5 chunks +5 lines, -5 lines 0 comments Download
M doc/tmpltohtml.go View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/Makefile View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -1 line 0 comments Download
M src/pkg/text/template/Makefile View 1 chunk +1 line, -2 lines 0 comments Download
M src/pkg/text/template/doc.go View 1 3 chunks +46 lines, -34 lines 0 comments Download
M src/pkg/text/template/exec.go View 1 2 3 4 5 chunks +15 lines, -20 lines 0 comments Download
M src/pkg/text/template/exec_test.go View 1 2 3 4 5 6 7 3 chunks +24 lines, -13 lines 0 comments Download
M src/pkg/text/template/funcs.go View 3 chunks +6 lines, -11 lines 0 comments Download
M src/pkg/text/template/helper.go View 1 2 3 4 5 6 7 8 9 3 chunks +60 lines, -193 lines 0 comments Download
M src/pkg/text/template/multi_test.go View 1 2 3 4 5 6 7 8 9 6 chunks +122 lines, -110 lines 0 comments Download
R src/pkg/text/template/parse.go View 1 chunk +0 lines, -83 lines 0 comments Download
M src/pkg/text/template/parse/parse.go View 1 2 5 chunks +21 lines, -9 lines 0 comments Download
M src/pkg/text/template/parse/parse_test.go View 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/text/template/template.go View 1 2 3 4 5 6 7 8 9 1 chunk +188 lines, -93 lines 0 comments Download
M src/pkg/text/template/testdata/tmpl1.tmpl View 1 chunk +2 lines, -0 lines 0 comments Download
M src/pkg/text/template/testdata/tmpl2.tmpl View 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 30
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 (2011-11-21 05:01:55 UTC) #1
dsymonds
I've only looked at the API in {doc,helper,template}.go. I like where it's heading. http://codereview.appspot.com/5415060/diff/1/src/pkg/text/template/doc.go File ...
13 years, 3 months ago (2011-11-21 06:13:59 UTC) #2
r
Hello golang-dev@googlegroups.com, dsymonds@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 3 months ago (2011-11-21 06:26:59 UTC) #3
r
http://codereview.appspot.com/5415060/diff/1/src/pkg/text/template/doc.go File src/pkg/text/template/doc.go (right): http://codereview.appspot.com/5415060/diff/1/src/pkg/text/template/doc.go#newcode21 src/pkg/text/template/doc.go:21: Once constructed, templates can be executed safely in parallel. ...
13 years, 3 months ago (2011-11-21 06:27:07 UTC) #4
dsymonds
LGTM http://codereview.appspot.com/5415060/diff/1/src/pkg/text/template/helper.go File src/pkg/text/template/helper.go (left): http://codereview.appspot.com/5415060/diff/1/src/pkg/text/template/helper.go#oldcode30 src/pkg/text/template/helper.go:30: func ParseFile(filename string) (*Template, error) { On 2011/11/21 ...
13 years, 3 months ago (2011-11-21 06:31:48 UTC) #5
adg
On 21 November 2011 17:31, <dsymonds@golang.org> wrote: > LGTM > > > http://codereview.appspot.com/5415060/diff/1/src/pkg/text/template/helper.go > File ...
13 years, 3 months ago (2011-11-21 06:36:54 UTC) #6
dsymonds
Oops.
13 years, 3 months ago (2011-11-21 06:38:22 UTC) #7
rsc
LGTM http://codereview.appspot.com/5415060/diff/2002/src/pkg/text/template/exec.go File src/pkg/text/template/exec.go (right): http://codereview.appspot.com/5415060/diff/2002/src/pkg/text/template/exec.go#newcode88 src/pkg/text/template/exec.go:88: // ExecuteTemplate applies the template associated with t ...
13 years, 3 months ago (2011-11-21 17:02:59 UTC) #8
r
http://codereview.appspot.com/5415060/diff/2002/src/pkg/text/template/exec.go File src/pkg/text/template/exec.go (right): http://codereview.appspot.com/5415060/diff/2002/src/pkg/text/template/exec.go#newcode88 src/pkg/text/template/exec.go:88: // ExecuteTemplate applies the template associated with t that ...
13 years, 3 months ago (2011-11-21 17:43:37 UTC) #9
r
Hello dsymonds@golang.org, adg@golang.org, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 3 months ago (2011-11-21 17:44:17 UTC) #10
rsc
On Mon, Nov 21, 2011 at 12:43, <r@golang.org> wrote: > i see no technical reason ...
13 years, 3 months ago (2011-11-21 17:49:48 UTC) #11
r2
On Nov 21, 2011, at 9:49 AM, Russ Cox wrote: > On Mon, Nov 21, ...
13 years, 3 months ago (2011-11-21 17:54:40 UTC) #12
r
Hello dsymonds@golang.org, adg@golang.org, rsc@golang.org, r@google.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 3 months ago (2011-11-21 17:55:30 UTC) #13
r2
(also, the Template and Templates methods let you get at other members of the set, ...
13 years, 3 months ago (2011-11-21 17:58:26 UTC) #14
gri
LGTM http://codereview.appspot.com/5415060/diff/5016/src/pkg/text/template/exec.go File src/pkg/text/template/exec.go (right): http://codereview.appspot.com/5415060/diff/5016/src/pkg/text/template/exec.go#newcode88 src/pkg/text/template/exec.go:88: // ExecuteTemplate applies the template associated with t ...
13 years, 3 months ago (2011-11-21 18:09:22 UTC) #15
r2
On Nov 21, 2011, at 4:46 PM, Ugorji wrote: > Just one thought. > > ...
13 years, 3 months ago (2011-11-22 01:25:44 UTC) #16
MikeSamuel
On 2011/11/22 01:25:44, r2 wrote: > On Nov 21, 2011, at 4:46 PM, Ugorji wrote: ...
13 years, 3 months ago (2011-11-23 17:04:05 UTC) #17
MikeSamuel
http://codereview.appspot.com/5415060/diff/15001/src/pkg/text/template/exec_test.go File src/pkg/text/template/exec_test.go (right): http://codereview.appspot.com/5415060/diff/15001/src/pkg/text/template/exec_test.go#newcode672 src/pkg/text/template/exec_test.go:672: err = tmpl.Template("tree").Execute(&b, tree) Maybe test that ExecuteTemplate(name, ...) ...
13 years, 3 months ago (2011-11-23 17:04:45 UTC) #18
r
Hello dsymonds@golang.org, adg@golang.org, rsc@golang.org, r@google.com, gri@golang.org, mikesamuel@gmail.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 3 months ago (2011-11-23 17:18:19 UTC) #19
r
I rearranged some code and cleaned up the paths. I think this is ready. Added ...
13 years, 3 months ago (2011-11-23 17:19:18 UTC) #20
r
Hello dsymonds@golang.org, adg@golang.org, rsc@golang.org, r@google.com, gri@golang.org, mikesamuel@gmail.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 3 months ago (2011-11-23 18:48:44 UTC) #21
r2
I added a Copy method as requested by Ugorji, since Mike thinks that case can ...
13 years, 3 months ago (2011-11-23 18:49:42 UTC) #22
MikeSamuel
LGTM
13 years, 3 months ago (2011-11-23 19:15:55 UTC) #23
nigeltao
http://codereview.appspot.com/5415060/diff/14005/src/pkg/text/template/template.go File src/pkg/text/template/template.go (right): http://codereview.appspot.com/5415060/diff/14005/src/pkg/text/template/template.go#newcode75 src/pkg/text/template/template.go:75: func (t *Template) Copy() *Template { IIRC, we had ...
13 years, 3 months ago (2011-11-23 22:43:13 UTC) #24
nigeltao
http://codereview.appspot.com/5415060/diff/14005/src/pkg/text/template/helper.go File src/pkg/text/template/helper.go (right): http://codereview.appspot.com/5415060/diff/14005/src/pkg/text/template/helper.go#newcode37 src/pkg/text/template/helper.go:37: // ParseFiles parses the named files and associates the ...
13 years, 3 months ago (2011-11-23 22:54:09 UTC) #25
r
http://codereview.appspot.com/5415060/diff/14005/src/pkg/text/template/helper.go File src/pkg/text/template/helper.go (right): http://codereview.appspot.com/5415060/diff/14005/src/pkg/text/template/helper.go#newcode37 src/pkg/text/template/helper.go:37: // ParseFiles parses the named files and associates the ...
13 years, 3 months ago (2011-11-24 04:02:13 UTC) #26
r
Hello dsymonds@golang.org, adg@golang.org, rsc@golang.org, r@google.com, gri@golang.org, mikesamuel@gmail.com, nigeltao@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 3 months ago (2011-11-24 04:04:15 UTC) #27
r2
New CL description: text/template: new, simpler API The Set type is gone. Instead, templates are ...
13 years, 3 months ago (2011-11-24 04:05:08 UTC) #28
adg
LGTM
13 years, 3 months ago (2011-11-24 04:05:55 UTC) #29
r
13 years, 3 months ago (2011-11-24 04:17:26 UTC) #30
*** Submitted as http://code.google.com/p/go/source/detail?r=45e3c28dc7b5 ***

text/template: new, simpler API

The Set type is gone. Instead, templates are automatically associated by
being parsed together; nested definitions implicitly create associations.
Only associated templates can invoke one another.

This approach dramatically reduces the breadth of the construction API.

For now, html/template is deleted from src/pkg/Makefile, so this can
be checked in. Nothing in the tree depends on it. It will be updated next.

R=dsymonds, adg, rsc, r, gri, mikesamuel, nigeltao
CC=golang-dev
http://codereview.appspot.com/5415060
Sign in to reply to this message.

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