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

Side by Side Diff: src/pkg/text/template/doc.go

Issue 13509046: code review 13509046: text/template: allow eq to take more than two arguments (Closed)
Patch Set: diff -r 9112544f0e77 https://code.google.com/p/go/ Created 10 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/pkg/text/template/exec_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 /* 5 /*
6 Package template implements data-driven templates for generating textual output. 6 Package template implements data-driven templates for generating textual output.
7 7
8 To generate HTML output, see package html/template, which has the same interface 8 To generate HTML output, see package html/template, which has the same interface
9 as this package but automatically secures HTML output against certain attacks. 9 as this package but automatically secures HTML output against certain attacks.
10 10
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 Returns the boolean truth of arg1 != arg2 319 Returns the boolean truth of arg1 != arg2
320 lt 320 lt
321 Returns the boolean truth of arg1 < arg2 321 Returns the boolean truth of arg1 < arg2
322 le 322 le
323 Returns the boolean truth of arg1 <= arg2 323 Returns the boolean truth of arg1 <= arg2
324 gt 324 gt
325 Returns the boolean truth of arg1 > arg2 325 Returns the boolean truth of arg1 > arg2
326 ge 326 ge
327 Returns the boolean truth of arg1 >= arg2 327 Returns the boolean truth of arg1 >= arg2
328 328
329 These functions work on basic types only (or named basic types, 329 For simpler multi-way equality tests, eq (only) accepts two or more
330 such as "type Celsius float32"). They implement the Go rules for 330 arguments and compares the second and subsequent to the first,
331 comparison of values, except that size and exact type are ignored, 331 returning in effect
332 so any integer value may be compared with any other integer value, 332
333 any unsigned integer value may be compared with any other unsigned 333 » arg1==arg2 || arg1==arg3 || arg1==arg4 ...
334 integer value, and so on. However, as usual, one may not compare 334
335 an int with a float32 and so on. 335 (Unlike with || in Go, however, eq is a function call and all the
336 arguments will be evaluated.)
337
338 The comparison functions work on basic types only (or named basic
339 types, such as "type Celsius float32"). They implement the Go rules
340 for comparison of values, except that size and exact type are
341 ignored, so any integer value may be compared with any other integer
342 value, any unsigned integer value may be compared with any other
343 unsigned integer value, and so on. However, as usual, one may not
344 compare an int with a float32 and so on.
336 345
337 Associated templates 346 Associated templates
338 347
339 Each template is named by a string specified when it is created. Also, each 348 Each template is named by a string specified when it is created. Also, each
340 template is associated with zero or more other templates that it may invoke by 349 template is associated with zero or more other templates that it may invoke by
341 name; such associations are transitive and form a name space of templates. 350 name; such associations are transitive and form a name space of templates.
342 351
343 A template may use a template invocation to instantiate another associated 352 A template may use a template invocation to instantiate another associated
344 template; see the explanation of the "template" action above. The name must be 353 template; see the explanation of the "template" action above. The name must be
345 that of a template associated with the template that contains the invocation. 354 that of a template associated with the template that contains the invocation.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 396
388 or to invoke a particular template explicitly by name, 397 or to invoke a particular template explicitly by name,
389 398
390 err := tmpl.ExecuteTemplate(os.Stdout, "T2", "no data needed") 399 err := tmpl.ExecuteTemplate(os.Stdout, "T2", "no data needed")
391 if err != nil { 400 if err != nil {
392 log.Fatalf("execution failed: %s", err) 401 log.Fatalf("execution failed: %s", err)
393 } 402 }
394 403
395 */ 404 */
396 package template 405 package template
OLDNEW
« no previous file with comments | « no previous file | src/pkg/text/template/exec_test.go » ('j') | no next file with comments »

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