Skip to content

Commit

Permalink
Set version command output to Stdout (#1869)
Browse files Browse the repository at this point in the history
  • Loading branch information
clebs committed Mar 24, 2021
1 parent 82778e2 commit 814bf0e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/commands/version.go
Expand Up @@ -2,6 +2,7 @@ package commands

import (
"encoding/json"
"fmt"
"strings"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -35,7 +36,7 @@ func (e *Executor) initVersion() {
RunE: func(cmd *cobra.Command, _ []string) error {
switch strings.ToLower(e.cfg.Version.Format) {
case "short":
cmd.Println(e.version)
fmt.Println(e.version)
case "json":
ver := jsonVersion{
Version: e.version,
Expand All @@ -46,9 +47,9 @@ func (e *Executor) initVersion() {
if err != nil {
return err
}
cmd.Println(string(data))
fmt.Println(string(data))
default:
cmd.Printf("golangci-lint has version %s built from %s on %s\n", e.version, e.commit, e.date)
fmt.Printf("golangci-lint has version %s built from %s on %s\n", e.version, e.commit, e.date)
}
return nil
},
Expand Down

0 comments on commit 814bf0e

Please sign in to comment.