docker/go-units

FromHumanSize accepts MiB but returns MB

smoser opened this issue · 2 comments

One might expect that FromHumanSize("1MiB") would either

  • return error
  • return units.MiB (1024 * 1024 * 1024)

Currently it does not raise error and returns units.MB (1000 * 1000 * 1000)

Yes, this is the way it works. I think we can fix this and accept e.g. KB as "human size" (1000) and KiB as "computer size" (1024), defaulting to "human size" for "FromHumanSize" and to "computer size" for "RAMInBytes".

Problem is, this will make things slightly incompatible with the current behavior.