Repository navigation
Highlights
- Replaced reflection and the hand-written integer conversion matrix with one generic checked cast.
- Added
uintptrand named integer support. - Added
SliceTIntoandSliceTUncheckedIntofor reuse of caller-owned buffers. SuccessfulIntoconversions perform zero allocations. - Reduced allocations when aggregating slice overflow errors.
- Added exhaustive boundary tests, fuzzing, race coverage, linting, and cross-architecture CI.
Breaking changes
- The module path is now
github.com/lunemec/as/v2. - Go 1.24 or newer is required.
Tand the named checked helpers accept integer types directly. Values stored inanymust be type-asserted, and pointers must be dereferenced first.InvalidTypeErrorand automatic pointer dereferencing have been removed; unsupported source types now fail at compile time.
Migration
go get github.com/lunemec/as/v2import "github.com/lunemec/as/v2"
value := any(int64(42))
n, err := as.T[int8](value.(int64))
pointer := new(int64)
*pointer = 42
n, err = as.T[int8](*pointer)Full changelog: v1.1.2...v2.0.0