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

Utilise stderr for error reporting in "generate" #94

Open
spukst3r opened this issue Aug 22, 2017 · 1 comment
Open

Utilise stderr for error reporting in "generate" #94

spukst3r opened this issue Aug 22, 2017 · 1 comment

Comments

@spukst3r
Copy link

Right now joe generates all output to stdout, even error reports. So, if you run it like this:

joe g osX >> .gitignore

You'll end up with invalid .gitignore file. The most common practice for this is to utilise stderr stream, so that the error isn't redirected to the file and is written to the terminal instead. And nothing gets written to the file.

@kendfss
Copy link

kendfss commented Oct 2, 2021

Any of these should work:

l := log.New(os.Stderr, "", 0)
l.Println("log msg")
os.Stderr.WriteString("Message")
fmt.Fprintf(os.Stderr, "number of foo: %d", nFoo)

Generally [package name].Fprint[ln or f] allows you to write to open buffers.

here's a fork that implements the first solution.

source

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