You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to fetch the version in a shell script: CI_VERSION=$(golangci-lint version --format short) I noticed the variable was empty and I could see the version printed in the terminal.
After investigating I found out that golangci-lint uses Cobra's Println function:
Version of golangci-lint
Installed automatically with VS Code
$ golangci-lint --versiongolangci-lint has version v1.38.0 built from (unknown, mod sum: "h1:hgZsLRzZrjhpp44Ak+fhXNzgrbDF39ETf22a+Jd3fJQ=") on (unknown)
Commands print to Stderr instead of StdOut
Trying to fetch the version in a shell script:
CI_VERSION=$(golangci-lint version --format short)
I noticed the variable was empty and I could see the version printed in the terminal.After investigating I found out that
golangci-lint
uses Cobra'sPrintln
function:golangci-lint/pkg/commands/version.go
Lines 35 to 38 in c1d7cfd
According to Cobra, that function prints to
Stderr
per default:https://github.com/spf13/cobra/blob/b55fa79836c63eab81e884e6ec1d7e4ae5c7f9b5/command.go#L1201
Version of golangci-lint
Installed automatically with VS CodeConfig file
Go environment
Verbose output of running
Code example or link to a public repository
The text was updated successfully, but these errors were encountered: