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

Does not work without specifying schema #39

Open
oschwald opened this issue May 30, 2024 · 2 comments
Open

Does not work without specifying schema #39

oschwald opened this issue May 30, 2024 · 2 comments

Comments

@oschwald
Copy link
Contributor

When using the binary from the release page or building master from the source, the command fails when a schema has not been specified:

[!] No schema specified, will run without table and column validation.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x870c29]

goroutine 1 [running]:
main.(*SQLVet).Vet(0xc000150ee0)
	/home/runner/work/sqlvet/sqlvet/main.go:43 +0x29
main.main.func2(0xc000189700?, {0xc00011ebd0?, 0x7?, 0xb7435e?})
	/home/runner/work/sqlvet/sqlvet/main.go:147 +0x45
github.com/spf13/cobra.(*Command).execute(0xc00016d808, {0xc000132010, 0x1, 0x1})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:920 +0x867
github.com/spf13/cobra.(*Command).ExecuteC(0xc00016d808)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1044 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:968
main.main()
	/home/runner/work/sqlvet/sqlvet/main.go:166 +0x1d6

It appears that s.Schema is nil in vet.NewContext(tables: s.Schema.Tables).

@aleksey-korolev
Copy link

Reproduces for me too with [email protected]

@houqp
Copy link
Owner

houqp commented Jun 20, 2024

could you try adding a nil check in there and pass in an empty map when schema is nil?

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

3 participants