]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
tpl/strings: Remove unnecessary error check
authorNigel van Keulen <nigel2392@gmail.com>
Fri, 15 Aug 2025 11:43:16 +0000 (13:43 +0200)
committerGitHub <noreply@github.com>
Fri, 15 Aug 2025 11:43:16 +0000 (13:43 +0200)
tpl/strings/truncate.go

index efa910618219f0d1f2a46612360d66b284f8ba29..727f57a0f7275f20385a0a6e1e4296fb806c0922 100644 (file)
@@ -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")