I'm trying to pass a string array to a method. Although it passes the assertion, I'm getting this error
cannot use temp (type interface {}) as type []string in argument to equalStringArray: need type assertion
Code:
if str, ok := temp.([]string); ok {
if !equalStringArray(temp, someotherStringArray) {
// do something
} else {
// do something else
}
}
I've also tried checking the type with reflect.TypeOf(temp)
and that's also printing []string