File tree Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ fmt.Println(bytes.Format(1323))
1919### Binary prefix
2020
2121``` go
22- fmt.Println (bytes.FormatBin (1323 ))
22+ fmt.Println (bytes.FormatB (1323 ))
2323```
2424
2525` 1.29 KiB `
Original file line number Diff line number Diff line change @@ -6,14 +6,15 @@ import (
66 "math"
77)
88
9- // Format formats bytes to string. For example, 1000 would returns 1 KB
9+ // Format formats bytes to string with decimal prefix. For example, 1000 would returns
10+ // 1 KB
1011func Format (b uint64 ) string {
1112 return format (float64 (b ), false )
1213}
1314
14- // FormatBin formats bytes to string as specified by ICE standard . For example,
15- // 1024 would return 1 KiB.
16- func FormatBin (b uint64 ) string {
15+ // FormatB formats bytes to string with binary prefix . For example, 1024 would
16+ // return 1 KiB.
17+ func FormatB (b uint64 ) string {
1718 return format (float64 (b ), true )
1819}
1920
Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ func TestFormat(t *testing.T) {
2222 }
2323}
2424
25- func TestFormatBin (t * testing.T ) {
26- f := FormatBin (1323 )
25+ func TestFormatB (t * testing.T ) {
26+ f := FormatB (1323 )
2727 if f != "1.29 KiB" {
2828 t .Errorf ("formatted bytes should be 1.29 KiB, found %s" , f )
2929 }
You can’t perform that action at this time.
0 commit comments