Skip to content

sqlc.(n?)arg panics when 0 arguments are passed in #1632

Closed
@ryan-berger

Description

@ryan-berger

Version

1.13.0

What happened?

I accidentally passed 0 arguments into sqlc.narg and received the following panic:

goroutine 1 [running]:
github.com/kyleconroy/sqlc/internal/sql/validate.ParamStyle({...., ......})

Which comes from this line:

https://github.com/kyleconroy/sqlc/blob/c2dcd56a5d8b2a3b2fa9c7f6545d0b1d5555be29/internal/sql/validate/param_style.go#L19

Although this is invalid input, it would be nice to have an error message printed out.

Relevant log output

No response

Database schema

No response

SQL queries

No response

Configuration

No response

Playground URL

No response

What operating system are you using?

Linux

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageNew issues that hasn't been reviewed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions