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

println is redirected to stderr #33

Closed
xylo04 opened this issue May 15, 2020 · 2 comments
Closed

println is redirected to stderr #33

xylo04 opened this issue May 15, 2020 · 2 comments

Comments

@xylo04
Copy link

xylo04 commented May 15, 2020

When using println in the subcommand, the output is directed to stderr instead of stdout. 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.

@xylo04
Copy link
Author

xylo04 commented May 15, 2020

Worth noting, using fmt.Println() is a workaround, but doesn't help if the subcommand is calling another library that uses println.

@slewiskelly
Copy link

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.

@xylo04 xylo04 closed this as completed Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants