Skip to content

Commit 0020733

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

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
@@ -51,6 +51,8 @@ func newMigrateCommand(log logutils.Log, info BuildInfo) *migrateCommand {
5151
log: log,
5252
}
5353

54+
log.SetLevel(logutils.LogLevelInfo)
55+
5456
migrateCmd := &cobra.Command{
5557
Use: "migrate",
5658
Short: "Migrate configuration file from v1 to v2",
@@ -98,7 +100,7 @@ func (c *migrateCommand) execute(_ *cobra.Command, _ []string) error {
98100
return err
99101
}
100102

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

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

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

125127
return nil
126128
}
@@ -136,7 +138,7 @@ func (c *migrateCommand) preRunE(cmd *cobra.Command, _ []string) error {
136138
os.Exit(exitcodes.NoConfigFileDetected)
137139
}
138140

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

141143
err := validateConfiguration("https://golangci-lint.run/jsonschema/golangci.v1.jsonschema.json", usedConfigFile)
142144
if err != nil {
@@ -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)