Skip to content

Commit 45ba668

Browse files
author
berryhe
committed
fix(units): iota units
1 parent 483774e commit 45ba668

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pkg/utils/units.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ package utils
33
// Binary size units
44
// See: http://en.wikipedia.org/wiki/Binary_prefix
55
const (
6-
KiB = 1024
7-
MiB = 1024 * KiB
8-
GiB = 1024 * MiB
9-
TiB = 1024 * GiB
6+
_ = iota // ignore first value by assigning to blank identifier
7+
KiB = 1 << (10 * iota) // 1 << (10*1)
8+
MiB // 1 << (10*2)
9+
GiB // 1 << (10*3)
10+
TiB // 1 << (10*4)
11+
PiB // 1 << (10*5)
12+
1013
)

0 commit comments

Comments
 (0)