Skip to content

Commit 7d44145

Browse files
committed
perf(util): use string concat for FormatSize
1 parent 57360ea commit 7d44145

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/util/formatSize.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package util
22

33
import (
4-
"bytes"
54
"strconv"
65
)
76

@@ -22,11 +21,7 @@ func fmtUnit(unitName string, unitValue int64, srcValue int64) string {
2221
prefix++
2322
}
2423

25-
buffer := &bytes.Buffer{}
26-
buffer.WriteString(strconv.Itoa(prefix))
27-
buffer.WriteString(unitName)
28-
29-
return buffer.String()
24+
return strconv.Itoa(prefix) + unitName
3025
}
3126

3227
func FormatSize(size int64) string {

0 commit comments

Comments
 (0)