go-units icon indicating copy to clipboard operation
go-units copied to clipboard

Parse and print size and time units in human-readable format

Results 12 go-units issues
Sort by recently updated
recently updated
newest added

Fixes issue #44. I am not sure if the function `HumanSizeWithPrecision` with `precision` of `1` behaves as expected. Please let me know if there is any improvement I can make.

Let's keep it short, such a test will fail: ``` assertEquals(t, "1GB", HumanSizeWithPrecision(999.6*MB, 3)) ``` With the following message: ``` Expected '1GB' but got '1e+03MB' ``` The case holds in...

Hello, team! I'd like to use `--ulimit memlock=infinity`, as `sys/resource.h` provides `RLIM_INFINITY`. Fortunately, `-1` is already supported as the infinity, so I've implemented a new keyword `infinity` as an alias...

Allow to parse units EB and EiB. I do not add ZB and YB because they are larger than int64 range

Keeping the go version to 1.12 for now, as this module doesn't require "latest and greatest"

When parsing the ulimit, we should check if the ulimit max value is greater then the processes max value. If yes then we should return an error. Signed-off-by: Daniel J...

go-units API is missing a method which would parse "32kB" as 32000 bytes, and "32kiB" as 32768 bytes. FromHumanSize() parses both as 32000 bytes, while RAMInBytes() parses both as 32768...

As discussed with @thaJeztah, this repo needs to be move to under moby, i.e. become `github.com/moby/go-units`.

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...

Functions like `RAMInBytes` offen used to parse memory set to cgroup, while Linux kernel take cgroup memory value as uint64, so we need the return value of `RAMInBytes` also be...