sqlrows icon indicating copy to clipboard operation
sqlrows copied to clipboard

panic: *ssa.UnOp during rows.Close()

Open nelsam opened this issue 5 years ago • 0 comments

The following code seems to cause sqlrows to panic:

rows, err := db.Query(a, b, c)
if err != nil {
    return err
}
func() {
    defer rows.Close()

    // read from rows...
}()

After digging in some, it seems that the deferred rows.Close() call inside of the closure is dereferencing the *sql.Rows value, because it comes out as an *ssa.UnOp instead of an *ssa.Extract.

nelsam avatar Nov 19 '19 19:11 nelsam