2 ms·
That seems like the kind of thing you'd want to wrap and panic on rather than ignore. If fmt.Print doesn't work, you should probably just kill the process.
by BobbyJo 3y ago
That seems like the kind of thing you'd want to wrap and panic on rather than ignore.
If fmt.Print doesn't work, you should probably just kill the process.
- comex 3y agoThat has the downside that if the user pipes your program’s standard output to, say, `head`, then once `head` is done reading the first few lines and exits, the program will blow up and probably print a message to standard error that clutters the user’s terminal (where they were expecting to see the first few lines of output). Though, continuing to spend time generating more output that goes nowhere may not be particularly useful either, depending on what the program does. Still I think ignoring errors writing to stdout is better as a general default. If nothing else, it’s the most common behavior and is thus more likely to fit the user’s expectations.