Skip to content

Commit dbc7222

Browse files
committed
small code improvement in repo cmd
1 parent 45655b8 commit dbc7222

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

commands/repo.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,20 +111,20 @@ func HandleRepoCommand(user string, repo string, verbose bool) {
111111
}
112112

113113
func createTopicStr(topics []string) string {
114-
topicStr := ""
114+
var topicStr strings.Builder
115115
perLine := 3
116116

117117
length := len(topics) - 1
118118

119119
for i, topic := range topics {
120-
topicStr += fmt.Sprintf("%s%s%s", ansi.Bold, topic, ansi.Reset)
120+
fmt.Fprintf(&topicStr, "%s%s%s", ansi.Bold, topic, ansi.Reset)
121121
if i != length {
122-
topicStr += ", "
122+
topicStr.WriteString(", ")
123123
if i%perLine == 0 && i >= perLine {
124-
topicStr += "\n"
124+
topicStr.WriteString("\n")
125125
}
126126
}
127127
}
128128

129-
return topicStr
129+
return topicStr.String()
130130
}

0 commit comments

Comments
 (0)