How do you convert a string to an integer in Go?

In Go, I prefer strconv.ParseInt() if I need a bit more control, like specifying the base or bit size. It’s slightly more flexible than Atoi():

num, err := strconv.ParseInt("42", 10, 64)

This comes in handy when you’re parsing non-decimal strings or targeting specific int types.