8000 Add `HumanSizeWithPrecision` function by yongtang · Pull Request #20 · docker/go-units · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add HumanSizeWithPrecision function #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2016
Merged

Add HumanSizeWithPrecision function #20

merged 1 commit into from
Sep 8, 2016

Conversation

yongtang
Copy link
Collaborator
@yongtang yongtang commented Sep 8, 2016

This fix adds HumanSizeWithPrecision func so that instead of fixed
precision of 4 in HumanSize, any precision could be specified.

This fix is related to:
moby/moby#26303
moby/moby#26300
in docker.

Signed-off-by: Yong Tang yong.tang.github@outlook.com

// CustomSize returns a human-readable approximation of a size
// using custom format.
func CustomSize(format string, size float64, base float64, _map []string) string {
func customSize(size float64, base float64, _map []string) (float64, string) {
Copy link
Contributor
@dnephin dnephin Sep 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could be called calculateSizeAndUnit(), getSizeAndUnit() or something like that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dnephin. The PR has been updated to getSizeAndUnit. Let me know if there are any issues.

This fix adds `HumanSizeWithPrecision` func so that instead of fixed
precision of 4 in `HumanSize`, any precision could be specified.

This fix is related to 26303, 26300 in docker.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
@dnephin
Copy link
Contributor
dnephin commented Sep 8, 2016

LGTM

@vdemeester
Copy link
Collaborator

LGTM 🐸

@vdemeester vdemeester merged commit f2145db into docker:master Sep 8, 2016
@yongtang yongtang deleted the 26300-docker-images-3-fractional-digits branch September 8, 2016 21:20
thaJeztah added a commit to thaJeztah/runc that referenced this pull request Mar 28, 2019
relevant changes:

  - docker/go-units#8 Enhance FromHumanSize to parse float64 string
  - docker/go-units#20 Add `HumanSizeWithPrecision` function

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah added a commit to thaJeztah/runc that referenced this pull request Mar 28, 2019
relevant changes:

  - docker/go-units#8 Enhance FromHumanSize to parse float64 string
  - docker/go-units#20 Add `HumanSizeWithPrecision` function

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
8000
thaJeztah added a commit to thaJeztah/runc that referenced this pull request Apr 12, 2019
relevant changes:

  - docker/go-units#8 Enhance FromHumanSize to parse float64 string
  - docker/go-units#20 Add `HumanSizeWithPrecision` function

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah added a commit to thaJeztah/runc that referenced this pull request Apr 12, 2019
relevant changes:

  - docker/go-units#8 Enhance FromHumanSize to parse float64 string
  - docker/go-units#20 Add `HumanSizeWithPrecision` function

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah added a commit to thaJeztah/runc that referenced this pull request Apr 12, 2019
relevant changes:

  - docker/go-units#8 Enhance FromHumanSize to parse float64 string
  - docker/go-units#20 Add `HumanSizeWithPrecision` function

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah added a commit to thaJeztah/containerd that referenced this pull request Apr 23, 2019
relevant changes:

- docker/go-units#19 make 1 second not to be plural seconds
- docker/go-units#20 Add `HumanSizeWithPrecision` function
- docker/go-units#21 change week display rule
- docker/go-units#22 Better human duration precision
- docker/go-units#23 Removes spaces before unit
- docker/go-units#27 Fix containerd#26 - RAMInBytes Bug
- docker/go-units#33 Fix handling of unlimited (-1) ulimit values
- docker/go-units#34 Revert 46 minute threshold

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah added a commit to thaJeztah/runc that referenced this pull request Apr 25, 2019
relevant changes:

  - docker/go-units#8 Enhance FromHumanSize to parse float64 string
  - docker/go-units#20 Add `HumanSizeWithPrecision` function

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah added a commit to thaJeztah/runc that referenced this pull request Jul 14, 2019
relevant changes:

  - docker/go-units#8 Enhance FromHumanSize to parse float64 string
  - docker/go-units#20 Add `HumanSizeWithPrecision` function

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah added a commit to thaJeztah/runc that referenced this pull request Aug 26, 2019
relevant changes:

  - docker/go-units#8 Enhance FromHumanSize to parse float64 string
  - docker/go-units#20 Add `HumanSizeWithPrecision` function

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah added a commit to thaJeztah/runc that referenced this pull request Sep 5, 2019
relevant changes:

  - docker/go-units#8 Enhance FromHumanSize to parse float64 string
  - docker/go-units#20 Add `HumanSizeWithPrecision` function

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
stefanberger pushed a commit to stefanberger/runc that referenced this pull request Dec 31, 2019
relevant changes:

  - docker/go-units#8 Enhance FromHumanSize to parse float64 string
  - docker/go-units#20 Add `HumanSizeWithPrecision` function

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
adrianreber pushed a commit to adrianreber/runc that referenced this pull request Feb 10, 2020
relevant changes:

  - docker/go-units#8 Enhance FromHumanSize to parse float64 string
  - docker/go-units#20 Add `HumanSizeWithPrecision` function

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0