1
0
mirror of https://github.com/golang/go synced 2024-11-22 09:24:41 -07:00

template: fix trivial bug: integers are not "empty"

Fixes #1357.

R=adg, gri
CC=golang-dev
https://golang.org/cl/3809041
This commit is contained in:
Rob Pike 2010-12-20 13:36:47 -08:00
parent 8bfa9175a3
commit d3866ddc65
2 changed files with 7 additions and 1 deletions

View File

@ -673,7 +673,7 @@ func empty(v reflect.Value) bool {
case *reflect.SliceValue: case *reflect.SliceValue:
return v.Len() == 0 return v.Len() == 0
} }
return true return false
} }
// Look up a variable or method, up through the parent if necessary. // Look up a variable or method, up through the parent if necessary.

View File

@ -197,6 +197,12 @@ var tests = []*Test{
out: " Header\n", out: " Header\n",
}, },
&Test{
in: "{.section integer}{@}{.end}",
out: "77",
},
// Repeated // Repeated
&Test{ &Test{
in: "{.section pdata }\n" + in: "{.section pdata }\n" +