Skip to content

Commit ab4b26c

Browse files
committed
Use strings.Join instead of += in loop
1 parent 93ac538 commit ab4b26c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

or.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package comver
22

3+
import "strings"
4+
35
//nolint:godox
46
// TODO: Make Or to be []Constrainter so that we can nest Or
57

@@ -21,15 +23,10 @@ func (o Or) Check(v Version) bool {
2123
}
2224

2325
func (o Or) String() string {
24-
s := ""
25-
26+
ss := make([]string, len(o))
2627
for i := range o {
27-
if i > 0 {
28-
s += " || "
29-
}
30-
31-
s += o[i].String()
28+
ss[i] = o[i].String()
3229
}
3330

34-
return s
31+
return strings.Join(ss, " || ")
3532
}

0 commit comments

Comments
 (0)