From: Nigel van Keulen Date: Fri, 15 Aug 2025 11:43:16 +0000 (+0200) Subject: tpl/strings: Remove unnecessary error check X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=348aae91e86369595665c7f3079758d0f198b069;p=brevno-suite%2Fhugo tpl/strings: Remove unnecessary error check --- diff --git a/tpl/strings/truncate.go b/tpl/strings/truncate.go index efa910618..727f57a0f 100644 --- a/tpl/strings/truncate.go +++ b/tpl/strings/truncate.go @@ -67,9 +67,7 @@ func (ns *Namespace) Truncate(s any, options ...any) (template.HTML, error) { default: return "", errors.New("too many arguments passed to truncate") } - if err != nil { - return "", errors.New("text to truncate must be a string") - } + text, err := cast.ToStringE(textParam) if err != nil { return "", errors.New("text must be a string")