Releases: ccoVeille/go-safecast
v2.0.0
What brings the v2 ?
- better performance (6bc8c53)
- Parse function for handling string (c6de71a)
- support of uintptr (696623e)
- Ability to Parse with a dedicated base: see Parse examples and strconv.ParseInt for more information (c6de71a)
- Add WithDecimalLossReport option for Convert to report when a float to integer could lead to decimal lost (748182b)
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
v1.8.1
What's Changed
- feat: use quotes when reporting issue with string conversion by @ccoVeille in #125
Minor
- chore: fix invalid go build tag by @ccoVeille in #124
Full Changelog: v1.8.0...v1.8.1
v1.8.0
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
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
- chore: improve MustConvert test by @ccoVeille in #107
- chore: remove CodeClimate integration by @ccoVeille in #117
Full Changelog: v1.6.1...v1.7.0
v1.6.1
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
- Fix typo in errors.go by @acquisitionist in #94
- chore: fix package documentation by @ccoVeille in #95
- ci: add more linters to golangci-lint by @ccoVeille in #96
New Contributors
- @acquisitionist made their first contribution in #94
Full Changelog: v1.6.0...v1.6.1
v1.6.0
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
v1.4.0
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
What's Changed
- ci: improve filename linting by @ccoVeille in #53
- refactoring by @ccoVeille in #48
- feat: add conversion to float32 and float64 by @ccoVeille in #54
Full Changelog: v1.2.0...v1.3.0