convert interface to string golang code example
Example 1: interface to string golang
var x interface{} = "abc"
str := fmt.Sprintf("%v", x)
Example 2: interface to string in golang
var x interface{} = []int{1, 2, 3}
str1 := fmt.Sprintf("%v", x)
str2 := x.(string)
fmt.Println(str1)
fmt.Println(str2)