4 ms·
A better example is the timeless: err := f1() if err != nil {..} // have to do this or compiler error err = f2() // oops, forgot to actually d
by jamwt 11y ago
A better example is the timeless:
err := f1()
if err != nil {..} // have to do this or compiler error
err = f2()
// oops, forgot to actually do anything about it!
Now, granted, `go vet` helps with this, but.. these kinds of things can be solved by the language proper in much better ways, and they should be type errors. Like rust's `Result` or Haskell's `Either`.
Edit: rust's result is especially nice with #[must_use]. This has saved my team from mistakes relatively frequently.