Skip to content
Merged
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
feat(generate): reorder codegen handlers to prefer plugins
resolves #2716
  • Loading branch information
andrewmbenton committed Oct 6, 2023
commit 13d5d8cb3ce45d17cff60b46e4a278d6288f2d20
16 changes: 8 additions & 8 deletions internal/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,6 @@ func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, re
var handler ext.Handler
var out string
switch {
case sql.Gen.Go != nil:
out = combo.Go.Out
handler = ext.HandleFunc(golang.Generate)

case sql.Gen.JSON != nil:
out = combo.JSON.Out
handler = ext.HandleFunc(json.Generate)

case sql.Plugin != nil:
out = sql.Plugin.Out
plug, err := findPlugin(combo.Global, sql.Plugin.Plugin)
Expand Down Expand Up @@ -404,6 +396,14 @@ func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, re
}
req.PluginOptions = opts

case sql.Gen.Go != nil:
out = combo.Go.Out
handler = ext.HandleFunc(golang.Generate)

case sql.Gen.JSON != nil:
out = combo.JSON.Out
handler = ext.HandleFunc(json.Generate)

default:
return "", nil, fmt.Errorf("missing language backend")
}
Expand Down