Add HumanSizeWithPrecision function#20
Merged
vdemeester merged 1 commit intodocker:masterfrom Sep 8, 2016
yongtang:26300-docker-images-3-fractional-digits
Merged
Add HumanSizeWithPrecision function#20vdemeester merged 1 commit intodocker:masterfrom yongtang:26300-docker-images-3-fractional-digits
HumanSizeWithPrecision function#20vdemeester merged 1 commit intodocker:masterfrom
yongtang:26300-docker-images-3-fractional-digits
Conversation
size.go
Outdated
| // 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) { |
Contributor
There was a problem hiding this comment.
Maybe this could be called calculateSizeAndUnit(), getSizeAndUnit() or something like that?
Collaborator
Author
There was a problem hiding this comment.
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>
Contributor
|
LGTM |
Collaborator
|
LGTM 🐸 |
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fix adds
HumanSizeWithPrecisionfunc so that instead of fixedprecision 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