Use /internal/memory constants#1354
Merged
dcantah merged 2 commits intomicrosoft:masterfrom Apr 18, 2022
Merged
Conversation
We have a bunch of 1024 * 1024 or 1024 * 1024 * 1024 numerical constants (or just other megabyte constants) lying around. This just changes to using the constants we have defined in the /internal/memory package. Signed-off-by: Daniel Canter <dcanter@microsoft.com>
helsaawy
approved these changes
Apr 14, 2022
Contributor
helsaawy
left a comment
There was a problem hiding this comment.
ive been wanting this for a while 😅
kevpar
reviewed
Apr 14, 2022
internal/memory/types.go
Outdated
| MegaByte = uint64(1024 * 1024) | ||
| GigaByte = 1024 * MegaByte | ||
| MegaByte uint64 = 1024 * 1024 | ||
| GigaByte uint64 = 1024 * MegaByte |
Member
There was a problem hiding this comment.
Technically this should be Gibibyte. Maybe we can fix that too?
Contributor
Author
There was a problem hiding this comment.
Sure, maybe we just shorten these to MiB and GiB then as well. Thoughts? cc @anmaxvl
Contributor
Author
There was a problem hiding this comment.
Changin in a follow up commit that we can squash at the end
* Change /internal/memory constants to MiB and GiB from MegaByte and GigaByte. * Leave constants untyped. Signed-off-by: Daniel Canter <dcanter@microsoft.com>
helsaawy
approved these changes
Apr 14, 2022
anmaxvl
approved these changes
Apr 18, 2022
anmaxvl
added a commit
that referenced
this pull request
Feb 7, 2023
princepereira
pushed a commit
to princepereira/hcsshim
that referenced
this pull request
Aug 29, 2024
* Use /internal/memory constants We have a bunch of 1024 * 1024 or 1024 * 1024 * 1024 numerical constants (or just other megabyte constants) lying around. This changes to using the constants we have defined in the /internal/memory package. This additionally changes the names of the constants from MegaByte/GigaByte to MiB/GiB and changes them to untyped constants. Signed-off-by: Daniel Canter <dcanter@microsoft.com>
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.
We have a bunch of 1024 * 1024 or 1024 * 1024 * 1024 numerical constants (or just other named megabyte constants) lying around. This changes to using the constants we have defined in the /internal/memory package instead.
This change additionally renames the memory.MegaByte and memory.GigaByte constants to Mib and GiB respectively, and leaves them as untyped consts.