Thanks all, figured out the issue:
func main() { a := big.NewInt(1) b := *a c := *a c.Sub(&c, big.NewInt(1)) fmt.Println(b.String()) fmt.Println(c.String()) fmt.Println(a.String()) } reproducible code. don't know what causing it tho :( On Wednesday, February 14, 2024 at 2:52:19 PM UTC+5:30 Brian Candler wrote: > Have you tried running your entire code under the race detector? > https://go.dev/blog/race-detector > > On Wednesday 14 February 2024 at 06:02:02 UTC Kurtis Rader wrote: > >> Maybe provide a minimal reproducible example ( >> https://stackoverflow.com/help/minimal-reproducible-example)? >> >> While it is theoretically possible there is a bug in the `big` package >> that could result in such panics it is much more likely the bug is in your >> code. So showing us how you are using the `big` package will help us help >> you. >> >> On Tue, Feb 13, 2024 at 9:36 PM Poonai <rbala...@gmail.com> wrote: >> >>> big int panics during text conversion randomly >>> >>> stack trace: >>> >>> panic: runtime error: index out of range [1] with length 1 >>> >>> goroutine 2088184 [running]: >>> math/big.nat.itoa({0xc01db71500, 0x1, 0x199?}, 0x0, 0xa) >>> /usr/local/go/src/math/big/natconv.go:340 +0x3d2 >>> math/big.(*Int).Text(...) >>> /usr/local/go/src/math/big/intconv.go:25 >>> math/big.(*Int).String(...) >>> /usr/local/go/src/math/big/intconv.go:40 >>> >>> It shows up randomly, help me debug >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "golang-nuts" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to golang-nuts...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/golang-nuts/db0a5e73-0a1d-4dfb-9629-1d54cf492f95n%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/golang-nuts/db0a5e73-0a1d-4dfb-9629-1d54cf492f95n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> >> >> -- >> Kurtis Rader >> Caretaker of the exceptional canines Junior and Hank >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/4e9b8a2b-ae01-4bb3-9a8d-8fa612da7a97n%40googlegroups.com.