How to convert an integer to a string in Golang?

In Golang, you can convert an integer to a string using the strconv.Itoa() function.

Here's an example:

package main import ( "fmt" "strconv" ) func main() { num := 42 str := strconv.Itoa(num) fmt.Println(str) // Output: "42" }

In this example, the strconv.Itoa() function takes an integer num as input and returns its corresponding string representation.