Skip to content

Wrong exit code if parsing queries failed #869

@maratori

Description

@maratori

If queries file contains syntax error, sqlc generate prints error into stderr, but exits with 0 code.
I expect exit code = 1.

I've found the reason.
Variable errored shadows variable from outer scope
https://github.com/kyleconroy/sqlc/blob/9fad44806957190645d1607e404cdf89c46b07f5/internal/cmd/generate.go#L154

... and this branch is not executed:
https://github.com/kyleconroy/sqlc/blob/9fad44806957190645d1607e404cdf89c46b07f5/internal/cmd/generate.go#L185

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions