Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rowserrcheck fails with a stackoverflow when it encounters this code pattern #31

Open
rajeshnair opened this issue Nov 15, 2023 · 0 comments

Comments

@rajeshnair
Copy link

rajeshnair commented Nov 15, 2023

rowserrcheck fails with a stackoverflow when it encounters code of this kind

This code pattern is specifically used when you have to convert row to you own golang struct


import (
	"database/sql"
	"fmt"
)

func issue_stackoverflow() {
	db, err := sql.Open("postgres", "postgres://localhost:5432/postgres")
	if err != nil {
		panic(err)
	}
	defer db.Close()

	rows, err := db.Query("select 1")
	if err != nil {
		panic(err)
	}
	defer rows.Close()
	getRows(rows)
}

func getRows(rows *sql.Rows) {
	for rows.Next() {
		fmt.Println("new rows")
	}
	if err := rows.Err(); err != nil {
		panic(err)
	}
}

Stack trace

goroutine 21 [running]:
github.com/jingyugao/rowserrcheck/passes/rowserr.(*runner).errCallMissing.func1({0x1043f51e8?, 0x14000cac500?})
	/Users/rajeshnair/projects/personal/rowserrcheck/passes/rowserr/rowserr.go:127 +0x490 fp=0x140211f03b0 sp=0x140211f03b0 pc=0x104206910
github.com/jingyugao/rowserrcheck/passes/rowserr.(*runner).errCallMissing.func1({0x1043f5c50?, 0x14000c92e70?})
	/Users/rajeshnair/projects/personal/rowserrcheck/passes/rowserr/rowserr.go:131 +0x46c fp=0x140211f0440 sp=0x140211f03b0 pc=0x1042068ec
github.com/jingyugao/rowserrcheck/passes/rowserr.(*runner).errCallMissing.func1({0x1043f5c50?, 0x14000c92e70?})
	/Users/rajeshnair/projects/personal/rowserrcheck/passes/rowserr/rowserr.go:131 +0x46c fp=0x140211f04d0 sp=0x140211f0440 pc=0x1042068ec
github.com/jingyugao/rowserrcheck/passes/rowserr.(*runner).errCallMissing.func1({0x1043f5c50?, 0x14000c92e70?})
	/Users/rajeshnair/projects/personal/rowserrcheck/passes/rowserr/rowserr.go:131 +0x46c fp=0x140211f0560 sp=0x140211f04d0 pc=0x1042068ec
github.com/jingyugao/rowserrcheck/passes/rowserr.(*runner).errCallMissing.func1({0x1043f5c50?, 0x14000c92e70?})
	/Users/rajeshnair/projects/personal/rowserrcheck/passes/rowserr/rowserr.go:131 +0x46c fp=0x140211f05f0 sp=0x140211f0560 pc=0x1042068ec
github.com/jingyugao/rowserrcheck/passes/rowserr.(*runner).errCallMissing.func1({0x1043f5c50?, 0x14000c92e70?})
	/Users/rajeshnair/projects/personal/rowserrcheck/passes/rowserr/rowserr.go:131 +0x46c fp=0x140211f0680 sp=0x140211f05f0 pc=0x1042068ec
github.com/jingyugao/rowserrcheck/passes/rowserr.(*runner).errCallMissing.func1({0x1043f5c50?, 0x14000c92e70?})
	/Users/rajeshnair/projects/personal/rowserrcheck/passes/rowserr/rowserr.go:131 +0x46c fp=0x140211f0710 sp=0x140211f0680 pc=0x1042068ec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant