docker/go-units

HumanSize strings cannot be round-tripped

wsong opened this issue · 1 comments

wsong commented

If I do:

size, err := units.FromHumanSize(units.HumanSize(1024.0 * 1024.0 * 1024.0))

I will get as an error:

invalid size: '1.074GB'

Presumably, FromHumanSize should be able to parse the strings that HumanSize outputs. I believe that this is because FromHumanSize doesn't handle decimal points.

wsong commented

Oh, ignore me; I had an old version of this library in my GOPATH.