Skip to content

Commit e102282

Browse files
committed
review: log level
1 parent b7ca75f commit e102282

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pkg/commands/migrate.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func (c *migrateCommand) execute(_ *cobra.Command, _ []string) error {
9898
return err
9999
}
100100

101-
c.cmd.Println("Migrating v1 configuration file:", srcPath)
101+
c.log.Infof("Migrating v1 configuration file: %s", srcPath)
102102

103103
ext := filepath.Ext(srcPath)
104104
if strings.TrimSpace(c.opts.format) != "" {
@@ -120,7 +120,7 @@ func (c *migrateCommand) execute(_ *cobra.Command, _ []string) error {
120120
return fmt.Errorf("saving configuration file: %w", err)
121121
}
122122

123-
c.cmd.Println("Migration done:", dstPath)
123+
c.log.Infof("Migration done: %s", dstPath)
124124

125125
return nil
126126
}
@@ -136,7 +136,7 @@ func (c *migrateCommand) preRunE(cmd *cobra.Command, _ []string) error {
136136
os.Exit(exitcodes.NoConfigFileDetected)
137137
}
138138

139-
c.cmd.Println("Validating v1 configuration file:", usedConfigFile)
139+
c.log.Infof("Validating v1 configuration file: %s", usedConfigFile)
140140

141141
err := validateConfiguration("https://golangci-lint.run/jsonschema/golangci.v1.jsonschema.json", usedConfigFile)
142142
if err != nil {
@@ -154,6 +154,8 @@ func (c *migrateCommand) preRunE(cmd *cobra.Command, _ []string) error {
154154
}
155155

156156
func (c *migrateCommand) persistentPreRunE(_ *cobra.Command, args []string) error {
157+
c.log.SetLevel(logutils.LogLevelInfo)
158+
157159
c.log.Infof("%s", c.buildInfo.String())
158160

159161
loader := config.NewBaseLoader(c.log.Child(logutils.DebugKeyConfigReader), c.viper, c.opts.LoaderOptions, c.cfg, args)
@@ -170,7 +172,7 @@ func (c *migrateCommand) backupConfigurationFile(srcPath string) error {
170172
filename := strings.TrimSuffix(filepath.Base(srcPath), filepath.Ext(srcPath)) + ".bck" + filepath.Ext(srcPath)
171173
dstPath := filepath.Join(filepath.Dir(srcPath), filename)
172174

173-
c.cmd.Println("Saving the v1 configuration to:", dstPath)
175+
c.log.Infof("Saving the v1 configuration to: %s", dstPath)
174176

175177
stat, err := os.Stat(srcPath)
176178
if err != nil {

0 commit comments

Comments
 (0)