Skip to content

Commit

Permalink
correct order of operations
Browse files Browse the repository at this point in the history
  • Loading branch information
Brookke committed Dec 17, 2024
1 parent c338d73 commit 5c610d3
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions api/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,6 @@ func Generate(cfg *config.Config, option ...Option) error {
return fmt.Errorf("merging type systems failed: %w", err)
}

if err = codegen.GenerateCode(data); err != nil {
return fmt.Errorf("generating core failed: %w", err)
}

if !cfg.SkipModTidy {
if err = cfg.Packages.ModTidy(); err != nil {
return fmt.Errorf("tidy failed: %w", err)
}
}

for _, p := range plugins {
if mut, ok := p.(plugin.CodeGenerator); ok {
err := mut.GenerateCode(data)
Expand All @@ -136,6 +126,15 @@ func Generate(cfg *config.Config, option ...Option) error {
}
}

if err = codegen.GenerateCode(data); err != nil {
return fmt.Errorf("generating core failed: %w", err)
}

if !cfg.SkipModTidy {
if err = cfg.Packages.ModTidy(); err != nil {
return fmt.Errorf("tidy failed: %w", err)
}
}
if !cfg.SkipValidation {
if err := validate(cfg); err != nil {
return fmt.Errorf("validation failed: %w", err)
Expand Down

0 comments on commit 5c610d3

Please sign in to comment.