labstack / gommon

Common packages for Go
MIT License
536 stars 100 forks source link

[Bytes] Format and Parse are not always reversible #12

Closed mdouchement closed 6 years ago

mdouchement commented 7 years ago

Description

Parse function does not support float values.

Expected behaviour

Support float values.

str := bytes.Format(13231323)
// -> 12.62MB

b, err := bytes.Parse(str)
// b -> 13233029  (truncated float 13233029.12)
// err ->  nil

Actual behaviour

str := bytes.Format(13231323)
// str -> 12.62MB

_, err := bytes.Parse(str)
// err ->  error parsing value=12.62MB

Version/commit

f72d3c883f8ea180da8f085dd320804c41332ad1

im-kulikov commented 6 years ago

Fixed by - https://github.com/labstack/gommon/pull/16