tpl/strings: Remove overflow check in strings.Repeat

The test fails on 32 bit systems. Let it panic instead.
This commit is contained in:
Bjørn Erik Pedersen 2018-06-03 23:23:48 +03:00
parent 90c7749085
commit 0c6c98e401
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
2 changed files with 1 additions and 4 deletions

View file

@ -432,8 +432,6 @@ func (ns *Namespace) Repeat(n, s interface{}) (string, error) {
if sn < 0 {
return "", errors.New("strings: negative Repeat count")
} else if sn > 0 && len(ss)*sn/sn != len(ss) {
return "", errors.New("strings: Repeat count causes overflow")
}
return _strings.Repeat(ss, sn), nil

View file

@ -16,7 +16,6 @@ package strings
import (
"fmt"
"html/template"
"math"
"testing"
"github.com/gohugoio/hugo/deps"
@ -730,7 +729,7 @@ func TestRepeat(t *testing.T) {
// errors
{"", tstNoStringer{}, false},
{tstNoStringer{}, "", false},
{"ab", math.MaxInt64, false},
{"ab", -1, false},
} {
errMsg := fmt.Sprintf("[%d] %v", i, test)