diff --git a/scan.go b/scan.go index 1c161a208..415b9f0d7 100644 --- a/scan.go +++ b/scan.go @@ -275,9 +275,7 @@ func Scan(rows Rows, db *DB, mode ScanMode) { if !update || reflectValue.Len() == 0 { update = false if isArrayKind { - for i := 0; i < reflectValue.Len(); i++ { - reflectValue.Index(i).Set(reflect.Zero(reflectValue.Index(i).Type())) - } + db.Statement.ReflectValue.Set(reflect.Zero(reflectValue.Type())) } else { // if the slice cap is externally initialized, the externally initialized slice is directly used here if reflectValue.Cap() == 0 {