-
Notifications
You must be signed in to change notification settings - Fork 12
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
Ignore global vars prefixed with {E,e}rr
#2
Comments
Yeah that's a good point. We could ignore global variables starting with |
Would you be up for taking a stab at this and opening a PR? |
Sure! Will take a look at it later today.
|
Error variables are variables starting with 'err' or 'Err' which were made by either errors.New or fmt.Errorf. There still is leeway for improvement such as checking if the node implements the error interface. This would allow us to whitelist custom error variables.
For the records: This has been implemented in #3. Don't know why GH doesn't crosslink to it. |
Error variables are variables starting with 'err' or 'Err' which were made by either errors.New or fmt.Errorf. There still is leeway for improvement such as checking if the node implements the error interface. This would allow us to whitelist custom error variables.
You need to reference this issue in the PR description for GH to crosslink it. Unfortunately the reference in the PR title doesn't crosslink. I just added the |
Error variables are variables starting with 'err' or 'Err'. This implements leighmcculloch#2.
Error variables are variables starting with 'err' or 'Err'. This implements leighmcculloch#2.
Ignore global variables that look like errors because they start with 'err' or 'Err'. Errors are a common thing to define at the package level, and are really used more like constants. Go doesn't allow an error to be defined as a constant though, so they are technically global variables. Since they aren't used to store state and having them defined at the package level is a common pattern, it doesn't make sense to prevent their existence. There still is leeway for improvement such as checking if the node implements the error interface. Fixes #2
It's a common practice to create global error variables such as the one above. It might be wise to not warn about them. What do you think?
The text was updated successfully, but these errors were encountered: