diff options
Diffstat (limited to 'src/strings/strings.go')
| -rw-r--r-- | src/strings/strings.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/strings/strings.go b/src/strings/strings.go index 1e8de2bc34..7cf3686569 100644 --- a/src/strings/strings.go +++ b/src/strings/strings.go @@ -523,8 +523,11 @@ func Map(mapping func(rune) rune, s string) string { // It panics if count is negative or if // the result of (len(s) * count) overflows. func Repeat(s string, count int) string { - if count == 0 { + switch count { + case 0: return "" + case 1: + return s } // Since we cannot return an error on overflow, |
