Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set version command output to Stdout #1869

Merged
merged 3 commits into from Mar 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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