SizeB doc comments
Vladimir Bauer
6 years ago
| 7 | 7 | "strings" |
| 8 | 8 | ) |
| 9 | 9 | |
| 10 | //go:generate stringer -type=SizeB1024 -trimprefix=_i | |
| 11 | //go:generate stringer -type=SizeB1000 -trimprefix=_ | |
| 12 | ||
| 10 | 13 | const ( |
| 11 | 14 | _ib SizeB1024 = iota + 1 |
| 12 | 15 | _iKiB SizeB1024 = 1 << (iota * 10) |
| 15 | 18 | _iTiB |
| 16 | 19 | ) |
| 17 | 20 | |
| 18 | //go:generate stringer -type=SizeB1024 -trimprefix=_i | |
| 21 | // SizeB1024 named type, which implements fmt.Formatter interface. It | |
| 22 | // adjusts its value according to byte size multiple by 1024 and appends | |
| 23 | // appropriate size marker (KiB, MiB, GiB, TiB). | |
| 19 | 24 | type SizeB1024 int64 |
| 20 | 25 | |
| 21 | 26 | func (self SizeB1024) Format(st fmt.State, verb rune) { |
| 79 | 84 | _TB SizeB1000 = _GB * 1000 |
| 80 | 85 | ) |
| 81 | 86 | |
| 82 | //go:generate stringer -type=SizeB1000 -trimprefix=_ | |
| 87 | // SizeB1000 named type, which implements fmt.Formatter interface. It | |
| 88 | // adjusts its value according to byte size multiple by 1000 and appends | |
| 89 | // appropriate size marker (KB, MB, GB, TB). | |
| 83 | 90 | type SizeB1000 int64 |
| 84 | 91 | |
| 85 | 92 | func (self SizeB1000) Format(st fmt.State, verb rune) { |