diff --git a/api/generate.go b/api/generate.go index 7b83be50a00..cca65d8f769 100644 --- a/api/generate.go +++ b/api/generate.go @@ -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) @@ -140,6 +130,11 @@ func Generate(cfg *config.Config, option ...Option) error { 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)