Skip to content

Commit 814bf0e

Browse files
authored
Set version command output to Stdout (#1869)
1 parent 82778e2 commit 814bf0e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/commands/version.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package commands
22

33
import (
44
"encoding/json"
5+
"fmt"
56
"strings"
67

78
"github.com/spf13/cobra"
@@ -35,7 +36,7 @@ func (e *Executor) initVersion() {
3536
RunE: func(cmd *cobra.Command, _ []string) error {
3637
switch strings.ToLower(e.cfg.Version.Format) {
3738
case "short":
38-
cmd.Println(e.version)
39+
fmt.Println(e.version)
3940
case "json":
4041
ver := jsonVersion{
4142
Version: e.version,
@@ -46,9 +47,9 @@ func (e *Executor) initVersion() {
4647
if err != nil {
4748
return err
4849
}
49-
cmd.Println(string(data))
50+
fmt.Println(string(data))
5051
default:
51-
cmd.Printf("golangci-lint has version %s built from %s on %s\n", e.version, e.commit, e.date)
52+
fmt.Printf("golangci-lint has version %s built from %s on %s\n", e.version, e.commit, e.date)
5253
}
5354
return nil
5455
},

0 commit comments

Comments
 (0)