buildkit/vendor/github.com/tonistiigi/units
Tibor Vass ad8b35e3d4 Migrate from vndr to go mod
go get -u github.com/tiborvass/gomod
  GO111MODULE=on gomod init
  GO111MODULE=on go mod tidy
  GO111MODULE=on go mod vendor

Signed-off-by: Tibor Vass <tibor@docker.com>
2019-01-31 22:44:47 +00:00
..
.travis.yml Migrate from vndr to go mod 2019-01-31 22:44:47 +00:00
LICENSE progressui: fix flicker on printing byte sizes 2017-09-25 21:01:39 -07:00
bytes.go vendor: update units to 6950e57a 2018-07-11 16:40:42 -07:00
readme.md progressui: fix flicker on printing byte sizes 2017-09-25 21:01:39 -07:00

readme.md

Simple byte size formatting.

This package implements types that can be used in stdlib formatting functions like fmt.Printf to control the output of the expected printed string.

Floating point flags %f and %g print the value in using the correct unit suffix. Decimal units are default, # switches to binary units. If a value is best represented as full bytes, integer bytes are printed instead.

Examples:
fmt.Printf("%.2f", 123 * B)   => "123B"
fmt.Printf("%.2f", 1234 * B)  => "1.23kB"
fmt.Printf("%g", 1200 * B)    => "1.2kB"
fmt.Printf("%#g", 1024 * B)   => "1KiB"

Integer flag %d always prints the value in bytes. # flag adds an unit prefix.

Examples:
fmt.Printf("%d", 1234 * B)    => "1234"
fmt.Printf("%#d", 1234 * B)   => "1234B"

%v is equal to %g