Skip to content

Conversation

@ccoVeille
Copy link
Owner

@ccoVeille ccoVeille commented Oct 27, 2025

  • package no longer supports converting from bool

    true/false are no longer converted to 1/0
    These values cannot overflow.

  • Convert no longer supports converting from string

    You can now use Parse function

  • string to number conversion no longer uses base 0 (auto-detect in Go strconv library)

    Use Parse function with proper base instead

  • Convert no longer returns 0 when conversion fails

    It now returns the invalid converted value with the error

  • Removed Input type (Input=string|bool|Number)

    This type was used by Convert function to represent input value.
    Now Convert function uses Number type directly.

  • Fixed float overflow handling with parse float from string

    Previously, it returned an ErrStringConversion error while it's an overflow.
    Now it returns the proper overflow error.

Fixes #82 #86

@ccoVeille ccoVeille self-assigned this Oct 27, 2025
@codecov
Copy link

codecov bot commented Oct 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (e16fe30) to head (d869865).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #120   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines          248       228   -20     
=========================================
- Hits           248       228   -20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ccoVeille ccoVeille force-pushed the v2 branch 3 times, most recently from 6dd7f6a to 895f377 Compare October 27, 2025 23:58
@ccoVeille ccoVeille marked this pull request as ready for review October 28, 2025 00:00
- package no longer supports converting from bool

    true/false are no longer converted to 1/0
    These values cannot overflow.

- Convert no longer supports converting from string

    You can now use Parse function

- string to number conversion no longer uses base 0 (auto-detect in Go strconv library)

    Use Parse function with proper base instead

- Convert no longer returns 0 when conversion fails

    It now returns the invalid converted value with the error

- Removed `Input` type (Input=string|bool|Number)

    This type was used by Convert function to represent input value.
    Now Convert function uses Number type directly.

- Fixed float overflow handling with parse float from string

    Previously, it returned an ErrStringConversion error while it's an overflow.
    Now it returns the proper overflow error.
Now we return the converted value with error, we can face issues
when the architecture provides different results for the same input.

For example, -1.0 as uint64 is 18446744073709551615 on Linux/amd64,
but 0 on Darwin/arm64.

Same for -1 to uint that is 18446744073709551615 on Linux/amd64,
but -18446744073709551615 on Darwin/arm64.

For this reason, we removed the converted value from the examples that
fails depending on the architecture.
@ccoVeille
Copy link
Owner Author

Moving back to draft as I include the non-breaking changes in the v1 via another PR.

Here are the ideas:

  • Add the Parse method in the v1
  • Deprecate the old ToInt helpers

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.

Refactor/reorganize code for better performance

2 participants