aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcell Martini <marcellmartini@gmail.com>2020-12-27 18:19:33 -0400
committerMarcell Martini <marcellmartini@gmail.com>2020-12-31 16:30:15 -0400
commit08fdacc08254a53169a19ff7f14cfad4c70655c1 (patch)
tree8f03d8dac964d294475af5d10ecefdd83685f5e1
parent98f9efbfb849fed66779b61bcda533a3ea73a496 (diff)
feat: Remove if inside loop from String()
-rw-r--r--cmd/echoip/main.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/cmd/echoip/main.go b/cmd/echoip/main.go
index 737a4f4..f3d4c94 100644
--- a/cmd/echoip/main.go
+++ b/cmd/echoip/main.go
@@ -3,6 +3,7 @@ package main
import (
"flag"
"log"
+ "strings"
"os"
@@ -14,14 +15,7 @@ import (
type multiValueFlag []string
func (f *multiValueFlag) String() string {
- vs := ""
- for i, v := range *f {
- vs += v
- if i < len(*f)-1 {
- vs += ", "
- }
- }
- return vs
+ return strings.Join([]string(*f), ", ")
}
func (f *multiValueFlag) Set(v string) error {