Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit08fdacc

Browse files
feat: Remove if inside loop from String()
1 parent98f9efb commit08fdacc

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

‎cmd/echoip/main.go‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"flag"
55
"log"
6+
"strings"
67

78
"os"
89

@@ -14,14 +15,7 @@ import (
1415
typemultiValueFlag []string
1516

1617
func (f*multiValueFlag)String()string {
17-
vs:=""
18-
fori,v:=range*f {
19-
vs+=v
20-
ifi<len(*f)-1 {
21-
vs+=", "
22-
}
23-
}
24-
returnvs
18+
returnstrings.Join([]string(*f),", ")
2519
}
2620

2721
func (f*multiValueFlag)Set(vstring)error {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp