You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
# Pointers and Errors
|
|
|
|
|
|
|
|
https://quii.gitbook.io/learn-go-with-tests/go-fundamentals/pointers-and-errors
|
|
|
|
|
|
|
|
## Handle Errors Gracefully
|
|
|
|
|
|
|
|
A must read:
|
|
|
|
|
|
|
|
https://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully
|
|
|
|
|
|
|
|
|
|
|
|
The author has a package https://pkg.go.dev/github.com/pkg/errors that you can use to implement the error handling pattern he outlines in the article.
|
|
|
|
|
|
|
|
## Use errcheck
|
|
|
|
|
|
|
|
You can use this static analysis tool to check if you have
|
|
|
|
potentially not handled an error case in your code
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
go install github.com/kisielk/errcheck@latest
|
|
|
|
errcheck <src dir>
|
|
|
|
```
|