Index: src/pkg/text/template/exec.go |
=================================================================== |
--- a/src/pkg/text/template/exec.go |
+++ b/src/pkg/text/template/exec.go |
@@ -393,7 +393,7 @@ |
switch { |
case constant.IsComplex: |
return reflect.ValueOf(constant.Complex128) // incontrovertible. |
- case constant.IsFloat && strings.IndexAny(constant.Text, ".eE") >= 0: |
+ case constant.IsFloat && !isHexConstant(constant.Text) && strings.IndexAny(constant.Text, ".eE") >= 0: |
return reflect.ValueOf(constant.Float64) |
case constant.IsInt: |
n := int(constant.Int64) |
@@ -407,6 +407,10 @@ |
return zero |
} |
+func isHexConstant(s string) bool { |
+ return len(s) > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X') |
+} |
+ |
func (s *state) evalFieldNode(dot reflect.Value, field *parse.FieldNode, args []parse.Node, final reflect.Value) reflect.Value { |
s.at(field) |
return s.evalFieldChain(dot, dot, field, field.Ident, args, final) |