|
|
|
|
|
by 4death4
842 days ago
|
|
In many cases, you don’t really need to check pointers unless you specifically want to handle the nil case. Go’s panic / recover feature lets you “catch” nil pointer access elsewhere. For instance, if you have an HTTP handler, it’s way easy to install a middleware that recovers from panics than it is to check for nil everywhere. |
|
Without it, you don't have that "this is guaranteed to exist at this point" indication that can actually reduce the overall number of checks in practice.