Merge pull request #502 from tonistiigi/update-units

vendor: update units to 6950e57a
docker-18.09
Akihiro Suda 2018-07-12 12:48:40 +09:00 committed by GitHub
commit fc8a3c52bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -46,7 +46,7 @@ github.com/mitchellh/hashstructure 2bca23e0e452137f789efbc8610126fd8b94f73b
github.com/docker/go-connections 3ede32e2033de7505e6500d6c868c2b9ed9f169d
github.com/docker/distribution 30578ca32960a4d368bf6db67b0a33c2a1f3dc6f
github.com/tonistiigi/units 29de085e9400559bd68aea2e7bc21566e7b8281d
github.com/tonistiigi/units 6950e57a87eaf136bbe44ef2ec8e75b9e3569de2
github.com/docker/cli 99576756eb3303b7af8102c502f21a912e3c1af6 https://github.com/tonistiigi/docker-cli.git
github.com/docker/docker-credential-helpers d68f9aeca33f5fd3f08eeae5e9d175edf4e731d1
github.com/docker/libnetwork 822e5b59d346b7ad0735df2c8e445e9787320e67

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
}