-
Notifications
You must be signed in to change notification settings - Fork 259
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
Use /internal/memory constants #1354
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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ive been wanting this for a while 😅
internal/memory/types.go
Outdated
MegaByte = uint64(1024 * 1024) | ||
GigaByte = 1024 * MegaByte | ||
MegaByte uint64 = 1024 * 1024 | ||
GigaByte uint64 = 1024 * MegaByte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically this should be Gibibyte. Maybe we can fix that too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, maybe we just shorten these to MiB and GiB then as well. Thoughts? cc @anmaxvl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that idea even more :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good to me 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changin in a follow up commit that we can squash at the end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
* Change /internal/memory constants to MiB and GiB from MegaByte and GigaByte. * Leave constants untyped. Signed-off-by: Daniel Canter <dcanter@microsoft.com>
* 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>
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.