sqlrows icon indicating copy to clipboard operation
sqlrows copied to clipboard

panic: if referrer is nil

Open tenntenn opened this issue 3 years ago • 2 comments

https://github.com/gostaticanalysis/sqlrows/blob/master/passes/sqlrows/sqlrows.go#L94 If refs is nil, *refs become a panic.

tenntenn avatar Sep 13 '21 08:09 tenntenn

Running into this as well. It would be helpful if it would not panic and say why or where this happens.

jtorvald avatar Nov 29 '22 15:11 jtorvald

With this you can reproduce the issue

func issue9() {
	var ctx context.Context
	var db *sql.DB
	rows, err := db.QueryContext(ctx, "SELECT * FROM users")
	if err != nil {
		log.Fatal(err)
	}
	defer rows.Close()

	func() {
		for rows.Next() {
			rows.Scan()
		}
	}()
}

jtorvald avatar Nov 30 '22 09:11 jtorvald