4 ms·
Is it that the defer() that recovers is called before the defer() that closes (and potentially fails)?
by matt_craig 2y ago
Is it that the defer() that recovers is called before the defer() that closes (and potentially fails)?
- randomdata 2y agoNo. No rearranging of the code would fix the problem.
- matt_craig 2y agoHmm. Checked the docs, looks like os.Create returns *File and err, but the sample doesn’t check that error.
- randomdata 2y agoos.Create, per the topic of discussion, is said to throw an error using the exception handling mechanism rather than return error. The exception handler checks the error. If you focus on errors, you’re going to never get it. The whole idea here is that the problem is bigger than errors.