diff options
Diffstat (limited to 'tpl/cast/cast.go')
-rw-r--r-- | tpl/cast/cast.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tpl/cast/cast.go b/tpl/cast/cast.go index c864b5e32..000e315f1 100644 --- a/tpl/cast/cast.go +++ b/tpl/cast/cast.go @@ -30,23 +30,23 @@ type Namespace struct { } // ToInt converts the given value to an int. -func (ns *Namespace) ToInt(v interface{}) (int, error) { +func (ns *Namespace) ToInt(v any) (int, error) { v = convertTemplateToString(v) return _cast.ToIntE(v) } // ToString converts the given value to a string. -func (ns *Namespace) ToString(v interface{}) (string, error) { +func (ns *Namespace) ToString(v any) (string, error) { return _cast.ToStringE(v) } // ToFloat converts the given value to a float. -func (ns *Namespace) ToFloat(v interface{}) (float64, error) { +func (ns *Namespace) ToFloat(v any) (float64, error) { v = convertTemplateToString(v) return _cast.ToFloat64E(v) } -func convertTemplateToString(v interface{}) interface{} { +func convertTemplateToString(v any) any { switch vv := v.(type) { case template.HTML: v = string(vv) |