CheckErr prints the msg with the prefix 'Error:' and exits with error code 1. If the msg is nil, it does nothing.
(msg interface{})
| 233 | |
| 234 | // CheckErr prints the msg with the prefix 'Error:' and exits with error code 1. If the msg is nil, it does nothing. |
| 235 | func CheckErr(msg interface{}) { |
| 236 | if msg != nil { |
| 237 | fmt.Fprintln(os.Stderr, "Error:", msg) |
| 238 | os.Exit(1) |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | // WriteStringAndCheck writes a string into a buffer, and checks if the error is not nil. |
| 243 | func WriteStringAndCheck(b io.StringWriter, s string) { |
no outgoing calls