Skip to content

Commit 156db1d

Browse files
ccoVeilleldez
andauthored
fix: error message when trying to migrate a migrated config (#5836)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent e7c4589 commit 156db1d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/commands/migrate.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ func newMigrateCommand(log logutils.Log, info BuildInfo) *migrateCommand {
8181
}
8282

8383
func (c *migrateCommand) execute(_ *cobra.Command, _ []string) error {
84-
if c.cfg.Version != "" {
85-
return fmt.Errorf("configuration version is already set: %s", c.cfg.Version)
86-
}
87-
8884
srcPath := c.viper.ConfigFileUsed()
8985
if srcPath == "" {
9086
c.log.Warnf("No config file detected")
@@ -141,6 +137,10 @@ func (c *migrateCommand) preRunE(cmd *cobra.Command, _ []string) error {
141137
return fmt.Errorf("unsupported format: %s", c.opts.format)
142138
}
143139

140+
if c.cfg.Version != "" {
141+
return fmt.Errorf("configuration version is already set: %s", c.cfg.Version)
142+
}
143+
144144
if c.opts.skipValidation {
145145
return nil
146146
}

0 commit comments

Comments
 (0)