cast.ToInt("08") return 0 and so on
Open
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 4k
- Forks
- 337
- Avg merge
- 15m
- Merged PRs (30d)
- 1
Description
`package main
import (
"fmt"
"strconv"
"github.com/spf13/cast"
)
func main() {
for i := 0; i <= 20; i++{
fmt.Println(cast.ToInt(fmt.Sprintf("0%d",i)))
}
fmt.Println("-------------------")
for i := 0; i <= 20; i++{
nums, _ := strconv.Atoi(fmt.Sprintf("0%d",i))
fmt.Println(nums)
}
}`
result:
0
1
2
3
4
5
6
7
0
0
8
9
10
11
12
13
14
15
0
0
16
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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 reproducing the reported conversions from the Go example and inspect the cast.ToInt entry point and its handling of numeric strings. Compare its results with strconv.Atoi for values such as "08", "017", and "018"; done means the cast behavior matches the demonstrated standard-library results, with regression coverage for the affected inputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100