vndr units to 6950e57

Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
This commit is contained in:
Andrew Hsu 2018-08-14 06:22:59 +00:00
parent 094ed67122
commit bb983ee75b
2 changed files with 10 additions and 2 deletions

View File

@ -92,5 +92,5 @@ k8s.io/kubernetes v1.8.14
k8s.io/kube-openapi 0c329704159e3b051aafac400b15baacf2a94a04
vbom.ml/util 928aaa586d7718c70f4090ddf83f2b34c16fdc8d
github.com/containerd/console 5d1b48d6114b8c9666f0c8b916f871af97b0a761
github.com/tonistiigi/units 29de085e9400559bd68aea2e7bc21566e7b8281d
github.com/tonistiigi/units 6950e57a87eaf136bbe44ef2ec8e75b9e3569de2
github.com/google/shlex 6f45313302b9c56850fc17f99e40caebce98c716

View File

@ -67,7 +67,7 @@ func (b Bytes) Format(f fmt.State, c rune) {
case 'f', 'g':
fv, unit, ok := b.floatValue(f.Flag('#'))
if !ok {
b.formatInt(f, 'd', true)
b.formatInt(&noPrecision{f}, 'd', true)
return
}
big.NewFloat(fv).Format(f, c)
@ -115,3 +115,11 @@ func (b Bytes) floatValue(binary bool) (float64, string, bool) {
return float64(b) / math.Abs(float64(baseUnit)), units[binary][i], true
}
}
type noPrecision struct {
fmt.State
}
func (*noPrecision) Precision() (prec int, ok bool) {
return 0, false
}