summaryrefslogtreecommitdiffstats
path: root/tpl/strings
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-06-03 23:23:48 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-06-03 23:23:48 +0300
commit0c6c98e401b22fa2737bb7266742ae88722825ab (patch)
treeae529822d09a6bc30d8a593be07159966a94e230 /tpl/strings
parent90c774908530390daa5813fcdd31435999971359 (diff)
tpl/strings: Remove overflow check in strings.Repeat
The test fails on 32 bit systems. Let it panic instead.
Diffstat (limited to 'tpl/strings')
-rw-r--r--tpl/strings/strings.go2
-rw-r--r--tpl/strings/strings_test.go3
2 files changed, 1 insertions, 4 deletions
diff --git a/tpl/strings/strings.go b/tpl/strings/strings.go
index 7bd6a9af0..d7d8f2d85 100644
--- a/tpl/strings/strings.go
+++ b/tpl/strings/strings.go
@@ -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
diff --git a/tpl/strings/strings_test.go b/tpl/strings/strings_test.go
index 6f714702c..69863c30d 100644
--- a/tpl/strings/strings_test.go
+++ b/tpl/strings/strings_test.go
@@ -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)