From 43eb238b08ed4028ddb9aefba4a5dc8b3b384b0b Mon Sep 17 00:00:00 2001 From: Frank Braun Date: Wed, 14 Jun 2017 19:47:40 +0000 Subject: [PATCH] Implement Spaces() with with strings.Repeat() Shorter and more efficient. --- cmd/micro/util.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cmd/micro/util.go b/cmd/micro/util.go index 8ba71d11..bbcc4f55 100644 --- a/cmd/micro/util.go +++ b/cmd/micro/util.go @@ -36,11 +36,7 @@ func NumOccurrences(s string, c byte) int { // Spaces returns a string with n spaces func Spaces(n int) string { - var str string - for i := 0; i < n; i++ { - str += " " - } - return str + return strings.Repeat(" ", n) } // Min takes the min of two ints