|
|
|
|
|
by dragonwriter
4712 days ago
|
|
Go supports exceptions (called "panics"). The substantive difference between Go and, e.g., Java with regard to exceptions is that Go builtin and standard library functions panic in a much narrower range of circumstances than Java's standard library. Go seems to prefer that the decision that an error condition is treated as a panic is generally left to user code that is written with more awareness of what is exceptional in the context of the role of that code than standard library code has. So, you could write the code in pretty much exactly the way you propose in Go; you'd just need to write a wrapper function around binary.Write that panics on errors. |
|
That makes little sense in the context of ioWriters and, frankly, most contexts.
How often do you write code where you deliberately want to be oblivious of IO errors?