New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
task: enable thelper and errorlint #225
Conversation
@@ -169,24 +169,6 @@ type ListOptions struct { | |||
ItemsPerPage int `url:"itemsPerPage,omitempty"` | |||
} | |||
|
|||
// ErrorResponse reports the error caused by an API request. | |||
type ErrorResponse struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved closer to the implementation of Error
@@ -222,7 +204,7 @@ func (resp *Response) CurrentPage() (int, error) { | |||
|
|||
pageNum, err := strconv.Atoi(pageNumStr) | |||
if err != nil { | |||
return 0, fmt.Errorf("error getting current page: %s", err) | |||
return 0, fmt.Errorf("error getting current page: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
w
is a go1.13 wrapper for errors which allows error.Is
to map wrapped errors
- bodyclose # checks whether HTTP response body is closed successfully [fast: false, auto-fix: false] | ||
- deadcode # Finds unused code [fast: false, auto-fix: false] | ||
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: false, auto-fix: false] | ||
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false] | ||
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: false, auto-fix: false] | ||
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. [fast: false, auto-fix: false] | ||
- exhaustive # check exhaustiveness of enum switch statements [fast: false, auto-fix: false] | ||
- exportloopref # checks for pointers to enclosing loop variables [fast: false, auto-fix: false] | ||
- gochecknoinits # Checks that no init functions are present in Go code [fast: true, auto-fix: false] | ||
- gocritic # Provides many diagnostics that check for bugs, performance and style issues. [fast: false, auto-fix: false] | ||
- gocyclo # Computes and checks the cyclomatic complexity of functions [fast: true, auto-fix: false] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding the description for each linter!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Description
Enables
thelper
, this linter makes sure that test helper functions callt.Helper
Enables
errorlint
, making sure error handling follow go1.13 error handling best practices