I am new to GO language and I am trying to get a value from a function which returns two strings, that is [str1, str2]
ret, err := fun1(....)
And function's prototype is
func fun1(...) (interface{}, error)
I print ret
, it is
[[57 57 56 56] [97 100 98 49 57 55 102 98 49 101 57 48 52 98 102 56 55 102 52 56 57 57 55 54 49 55 101 57 49 100 98 49]]
which looks like the type [][]uint8
, so, I tried this way
v, _ := ret.([][]uint8)
str1, _ := strconv.Atoi(string(v[0]))
str2, _ := strconv.Atoi(string(v[1]))
it failed, v is []
And I also tried:
v, _ := ret.([]string)
nothing changed
How to solve this? Any help will be appreciated :)
PS: I debug and find the first string is "9988"