Closed xylo04 closed 3 years ago
Worth noting, using fmt.Println()
is a workaround, but doesn't help if the subcommand is calling another library that uses println
.
I would consider using fmt.Println(...)
to be the correct use, as opposed to a workaround.
This package does not use the println
function directly, and this package cannot, and should not, control where output of a subcommand is being directed.
The println
function always directs to stderr
, and am not sure that it is intended for use in production code.
Also note that the language spec, suggests that implementations may change or even be removed entirely.
When using
println
in the subcommand, the output is directed tostderr
instead ofstdout
. This is important for command line utilities which differentiate between status messages and output which should be piped elsewhere, e.g. a file or another process.