Skip to content

Commit 8dd44f5

Browse files
committed
feat: check version of the configuration
1 parent 1400552 commit 8dd44f5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pkg/commands/fmt.go

+4
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ func (c *fmtCommand) persistentPreRunE(cmd *cobra.Command, args []string) error
8989
}
9090

9191
func (c *fmtCommand) preRunE(_ *cobra.Command, _ []string) error {
92+
if c.cfg.Version != "2" {
93+
return fmt.Errorf("invalid version of the configuration: %q", c.cfg.Version)
94+
}
95+
9296
metaFormatter, err := goformatters.NewMetaFormatter(c.log, &c.cfg.Formatters, &c.cfg.Run)
9397
if err != nil {
9498
return fmt.Errorf("failed to create meta-formatter: %w", err)

pkg/commands/run.go

+4
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ func (c *runCommand) persistentPostRunE(_ *cobra.Command, _ []string) error {
185185
}
186186

187187
func (c *runCommand) preRunE(_ *cobra.Command, args []string) error {
188+
if c.cfg.Version != "2" {
189+
return fmt.Errorf("invalid version of the configuration: %q", c.cfg.Version)
190+
}
191+
188192
dbManager, err := lintersdb.NewManager(c.log.Child(logutils.DebugKeyLintersDB), c.cfg,
189193
lintersdb.NewLinterBuilder(), lintersdb.NewPluginModuleBuilder(c.log), lintersdb.NewPluginGoBuilder(c.log))
190194
if err != nil {

0 commit comments

Comments
 (0)