diff options
author | Rob Pike <r@golang.org> | 2011-06-03 00:09:42 +1000 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2011-06-03 00:09:42 +1000 |
commit | 9995d216eb7442d8ec9b6f4c32f29b8289aa7dff (patch) | |
tree | 8d209115ffb16fe86e3d094721affafd21de814e | |
parent | 07acc02a29ac74e7c0b08b4cd382bf71acd262dd (diff) | |
download | go-9995d216eb7442d8ec9b6f4c32f29b8289aa7dff.tar.gz go-9995d216eb7442d8ec9b6f4c32f29b8289aa7dff.zip |
template: explain that fields must be exported.
Fixes #1792.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4548083
-rw-r--r-- | src/pkg/template/template.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/pkg/template/template.go b/src/pkg/template/template.go index 1011190044..f481cbd1ee 100644 --- a/src/pkg/template/template.go +++ b/src/pkg/template/template.go @@ -17,12 +17,15 @@ Data items may be values or pointers; the interface hides the indirection. - In the following, 'field' is one of several things, according to the data. + In the following, 'Field' is one of several things, according to the data. - - The name of a field of a struct (result = data.field), - - The value stored in a map under that key (result = data[field]), or + - The name of a field of a struct (result = data.Field), + - The value stored in a map under that key (result = data["Field"]), or - The result of invoking a niladic single-valued method with that name - (result = data.field()) + (result = data.Field()) + + If Field is a struct field or method name, it must be an exported + (capitalized) name. Major constructs ({} are the default delimiters for template actions; [] are the notation in this comment for optional elements): |