reflect.Value.Set using unaddressable value

You have to call Find with a pointer to the slice.

err := db.Find(&users).Error

relevant Gorm documentation: http://jinzhu.me/gorm/crud.html#query

Leave a Comment