Skip to content

Rework ParseBytes to return uint64 instead of interface#148

Merged
martialblog merged 1 commit into
mainfrom
refactor/convert
Jun 11, 2026
Merged

Rework ParseBytes to return uint64 instead of interface#148
martialblog merged 1 commit into
mainfrom
refactor/convert

Conversation

@martialblog

Copy link
Copy Markdown
Member

Fixes #147

@martialblog martialblog added this to the v1.0.0 milestone Jun 9, 2026
@martialblog martialblog requested a review from RincewindsHat June 9, 2026 14:15
@martialblog martialblog self-assigned this Jun 9, 2026
Comment thread convert/bytes_common.go Outdated
@RincewindsHat

Copy link
Copy Markdown
Member

hm, wouldn't it make sense to remove the types BytesSI and BytesIEC completely and replace them with a simple formatter function which receives an argument whether IEC or SI is wished for?
Sure, there is no String interface there anymore, but it feels like a lot of overhead atm.

@martialblog

Copy link
Copy Markdown
Member Author

Yeah I think you're right. We can simplify that.

@martialblog

Copy link
Copy Markdown
Member Author

@RincewindsHat I squashed some things together while keeping the same functionality

@RincewindsHat RincewindsHat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good now, minmal and pretty clear.

Should we keep the Bytes = uint64 alias to make it more obvious that you get that from the one function and put it into the other?
Or is it plainly obvious that the uint64 is the number of bytes?

@martialblog

Copy link
Copy Markdown
Member Author

I think uint64 and clear documentation is fine.

Also replaces byte types with functions
@martialblog

Copy link
Copy Markdown
Member Author

@RincewindsHat squashed the commits, added some examples to the docs.

@martialblog martialblog merged commit 2a84055 into main Jun 11, 2026
2 checks passed
@martialblog martialblog deleted the refactor/convert branch June 11, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review ByteAny interface and ParseBytes

2 participants