In my program I got 2 models:
type User struct {
Name string
}
type Article struct {
Title string
}
And I got arrays of data of these structs:
users := []User
articles := []Article
I'm trying to iterate over both of them at the same piece of code:
models := [][]interface{} {users, articles}
for _, model := range models {
log.Printf("%#v", model)
}
But I'm receiving an error:
cannot use users (type []User) as type []interface {} in array element
What am I doing wrong?