Feature: Add ToSliceX for numeric types
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 4k
- Forks
- 337
- Avg merge
- 15m
- Merged PRs (30d)
- 1
Description
I propose adding ToSliceX helper functions to the cast package for converting values into slices of numeric types (e.g. []int, []int64, []float64).
Proposed API
ToIntSlice(i interface{}) []int
ToIntSliceE(i interface{}) ([]int, error)
ToInt64Slice(i interface{}) []int64
ToFloat64Slice(i interface{}) []float64
/* other functions */
These functions would convert common inputs like []interface{}, []string, or already-typed slices.
Benefits
- Reduces boilerplate
- Improves consistency with existing
castAPIs - Makes numeric slice handling simpler and safer
Contribution
I’m happy to implement this feature, including tests and documentation, if the maintainers agree with the approach.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing cast APIs and conversion conventions in the cast package. Confirm the proposed numeric slice functions and supported inputs with maintainers, then add tests and documentation covering []interface{}, []string, and already-typed slices; done means the agreed API is implemented consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100