Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion internal/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,11 @@ func remoteGenerate(ctx context.Context, configPath string, conf *config.Config,
func parse(ctx context.Context, name, dir string, sql config.SQL, combo config.CombinedSettings, parserOpts opts.Parser, stderr io.Writer) (*compiler.Result, bool) {
defer trace.StartRegion(ctx, "parse").End()
c, err := compiler.NewCompiler(sql, combo)
defer c.Close(ctx)
defer func() {
if c != nil {
c.Close(ctx)
}
}()
if err != nil {
fmt.Fprintf(stderr, "error creating compiler: %s\n", err)
return nil, true
Expand Down
2 changes: 2 additions & 0 deletions internal/endtoend/testdata/bad_config/engine/query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- name: Test :exec
SELECT 1;
8 changes: 8 additions & 0 deletions internal/endtoend/testdata/bad_config/engine/sqlc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
sql:
- queries: query.sql
schema: query.sql
engine: "bad_engine"
gen:
go:
out: "db"
1 change: 1 addition & 0 deletions internal/endtoend/testdata/bad_config/engine/stderr.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error creating compiler: unknown engine: bad_engine