Skip to content

Releases: ccoVeille/go-safecast

v2.0.0

03 Nov 22:08

Choose a tag to compare

What brings the v2 ?

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.

BREAKING CHANGES

  • package no longer supports converting from bool

true/false are no longer converted to 1/0
These values cannot overflow, this was an error.

  • 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

This solves issue with 07 being parsed as 7, and 08 being reported as an invalid octal

  • Convert no longer returns 0 when conversion fails (e6c5137)

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.

This also drastically improves performance as it removes the type assertion checks.

All of these was introduced with #120

Minor

  • build(deps): bump crate-ci/typos from 1.38.1 to 1.39.0 in the all group by @dependabot[bot] in #127

Full Changelog: v1.8.1...v2.0.0

v1.8.2 deprecate the v1

03 Nov 22:14

Choose a tag to compare

What's Changed

v1 is now deprecated, please use v2

d47929d

Full Changelog: v1.8.1...v1.8.2

v1.8.1

31 Oct 00:32
28158aa

Choose a tag to compare

What's Changed

  • feat: use quotes when reporting issue with string conversion by @ccoVeille in #125

Minor

Full Changelog: v1.8.0...v1.8.1

v1.8.0

29 Oct 14:50

Choose a tag to compare

What's Changed

  • chore: add deprecation notice to all ToIntXX and ToUIntXX functions by @ccoVeille in #122

Full Changelog: v1.7.0...v1.8.0

v1.7.0

14 Oct 22:05

Choose a tag to compare

What's Changed

  • refactor: remove type assertions by @ccoVeille in #116
  • build(deps): bump crate-ci/typos from 1.36.2 to 1.36.3 in the all group by @dependabot[bot] in #115
  • fix: handle Go +/- math.Inf and NaN in conversions by @ccoVeille in #118
  • feat: add RequireConvert function by @ccoVeille in #106

Minor

Full Changelog: v1.6.1...v1.7.0

v1.6.1

21 Mar 17:56

Choose a tag to compare

This is a maintenance release.

Nothing was added to the API, @acquisitionist spotted an issue with the documentation and fixed it.
I then worked on activating some linters to detect such use cases.

What's Changed

New Contributors

Full Changelog: v1.6.0...v1.6.1

v1.6.0

12 Mar 16:37

Choose a tag to compare

Breaking Changes

  • feat: remove error and fmt.Stringer support by @ccoVeille in #77
  • chore: change the signature of the Convert and MustConvert by @ccoVeille in #78

What's Changed

  • ci: enforce the library has no dependencies except the standard library by @ccoVeille in #69
  • fix type alias issue by @ccoVeille in #81

Full Changelog: v1.5.0...v1.6.0

v1.5.0

18 Dec 00:40

Choose a tag to compare

What's Changed

Full Changelog: v1.4.0...v1.5.0

v1.4.0

17 Dec 23:41

Choose a tag to compare

v1.4.0 Pre-release
Pre-release

What's Changed

  • Add Convert and support conversion from string and boolean by @ccoVeille in #55
  • More errors were added.
  • 💥 Breaking changes: Remove Error struct that was exposed. It brought confusion

Minor

  • ci: fix codeclimate by @ccoVeille in #57
  • build(deps): bump crate-ci/typos from 1.28.2 to 1.28.3 in the all group by @dependabot in #56
  • doc: add popularity badge and stargazers graph by @ccoVeille in #58

Full Changelog: v1.3.0...v1.4.0

v1.3.0

15 Dec 01:17

Choose a tag to compare

v1.3.0 Pre-release
Pre-release

What's Changed

Full Changelog: v1.2.0...v1.3.0