I am trying to use the strings.Repeat function in a partial template. While I can use the other string functions such as strings.TrimPrefix
, I cannot get strings.Repeat
to work. I consistently get the error:
error calling partial: template: partials/test.html:4:10: executing "partials/test.html" at <strings>: can't evaluate field Repeat in type interface {}
The testing partial template is:
<pre>
{{ print "begin" }}
{{ print (strings.TrimPrefix "ab" "abba" ) }}
{{ print (strings.Repeat "yo" 4) }}
{{ print "end" }}
</pre>
Instead of the error I had expected to see:
begin
ba
yoyoyoyo
end
The partial template works to without the strings.Repeat
call to produce:
begin
ba
end
Am I doing something wrong? Or could it be improperly implemented or documented?
I noticed in the code for strings.Repeat that the order of arguments are reversed compared to the docs. EG: the docs for strings.TrimPrefix and code are both prefix string
, where as one Repeat is input count
and the other is count input