I ran into this when parsing config values from a file. At first, I used fmt.Sscanf
, but quickly switched to strconv.Atoi()
, way more reliable and idiomatic in Go.
If you’re dealing with flags or user input, Atoi()
is your friend. Just make sure to handle the error properly!