summaryrefslogtreecommitdiff
path: root/src/pkg/template/template.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-09-14 21:03:53 -0700
committerRuss Cox <rsc@golang.org>2009-09-14 21:03:53 -0700
commitc67478eb2cfefebf09d0c648efa24bb9578078ba (patch)
tree026f00b9ffbf7b5b865b8a3c9749c1499e2b182a /src/pkg/template/template.go
parenta4b4090443684cc9a82c272f2c7ae598c5aceca8 (diff)
downloadgolang-c67478eb2cfefebf09d0c648efa24bb9578078ba.tar.gz
fix "declared and not used" in tests;
also template/template.go, missed last time. R=r DELTA=116 (61 added, 10 deleted, 45 changed) OCL=34620 CL=34622
Diffstat (limited to 'src/pkg/template/template.go')
-rw-r--r--src/pkg/template/template.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/pkg/template/template.go b/src/pkg/template/template.go
index 46003b767..4d77a5417 100644
--- a/src/pkg/template/template.go
+++ b/src/pkg/template/template.go
@@ -397,12 +397,12 @@ func (t *Template) newVariable(name_formatter string) (v *variableElement) {
// Is it in user-supplied map?
if t.fmap != nil {
- if fn, ok := t.fmap[formatter]; ok {
+ if _, ok := t.fmap[formatter]; ok {
return
}
}
// Is it in builtin map?
- if fn, ok := builtins[formatter]; ok {
+ if _, ok := builtins[formatter]; ok {
return
}
t.parseError("unknown formatter: %s", formatter);
@@ -631,17 +631,17 @@ func (t *Template) writeVariable(v *variableElement, st *state) {
val := t.varValue(v.name, st).Interface();
// is it in user-supplied map?
if t.fmap != nil {
- if fn, ok := t.fmap[v.formatter]; ok {
- fn(st.wr, val, v.formatter);
+ if fn, ok := t.fmap[formatter]; ok {
+ fn(st.wr, val, formatter);
return;
}
}
// is it in builtin map?
- if fn, ok := builtins[v.formatter]; ok {
- fn(st.wr, val, v.formatter);
+ if fn, ok := builtins[formatter]; ok {
+ fn(st.wr, val, formatter);
return;
}
- t.execError(st, v.linenum, "missing formatter %s for variable %s", v.formatter, v.name)
+ t.execError(st, v.linenum, "missing formatter %s for variable %s", formatter, v.name)
}
// Execute element i. Return next index to execute.
@@ -796,7 +796,7 @@ func validDelim(d []byte) bool {
if len(d) == 0 {
return false
}
- for i, c := range d {
+ for _, c := range d {
if white(c) {
return false
}