-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Validation of the magic comment is not quite right. If you omit the directive of how the query should be handled, sqlc panics:
panic: runtime error: index out of range
goroutine 1 [running]:
github.com/kyleconroy/sqlc/internal/dinosql.parseMetadata(0xc0004c02c0, 0x52, 0x900b60, 0xc00000e760, 0x0, 0x52, 0xc0004c02c0, 0x52)
/home/runner/work/sqlc/sqlc/internal/dinosql/parser.go:294 +0x1e7
github.com/kyleconroy/sqlc/internal/dinosql.parseQuery(0xc00017a030, 0x900b60, 0xc0004cffc0, 0xc0004c02c0, 0x145, 0x0, 0x0, 0x0)
/home/runner/work/sqlc/sqlc/internal/dinosql/parser.go:322 +0x2cb
github.com/kyleconroy/sqlc/internal/dinosql.ParseQueries(0xc00017a030, 0xc0000deea0, 0x1, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/runner/work/sqlc/sqlc/internal/dinosql/parser.go:210 +0x6e6
github.com/kyleconroy/sqlc/internal/cmd.glob..func4(0xe0db40, 0xe3e5a8, 0x0, 0x0)
/home/runner/work/sqlc/sqlc/internal/cmd/cmd.go:142 +0x9b7
github.com/spf13/cobra.(*Command).execute(0xe0db40, 0xe3e5a8, 0x0, 0x0, 0xe0db40, 0xe3e5a8)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830 +0x2ae
github.com/spf13/cobra.(*Command).ExecuteC(0xc000160280, 0xc0000bbf20, 0x1, 0x1)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914 +0x2fc
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
github.com/kyleconroy/sqlc/internal/cmd.Do(0xc0000a0010, 0x1, 0x1, 0x8fac60, 0xc00009a000, 0x8fac80, 0xc00009a008, 0x8fac80, 0xc00009a010, 0xc000080058)
/home/runner/work/sqlc/sqlc/internal/cmd/cmd.go:33 +0x24a
main.main()
/home/runner/work/sqlc/sqlc/cmd/sqlc/main.go:10 +0xab
Test case:
-- name: ListFlags
SELECT * FROM flag;
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working