Go functions commonly return a useful result and an error. Check the error before you use the result. A zero result can be legitimate, so it cannot stand in for a success flag. errors.New names a failure and fmt.Errorf can add context; later you will preserve error identity with wrapping. Cleanup belongs near acquisition. A deferred call runs when the surrounding function returns, including an early error return, and several deferred calls run in reverse order. Its arguments are evaluated when the defer statement runs. These exercises turn those rules into observable values. You will reject a bad quantity, preserve a parser error and prove that a resource was closed. Ordinary validation failures should come back as errors, not panics.
Successful division uses integer arithmetic.