golangci: Enable new linter added to last release

Enable a new golangci-lint linter that has been added to the last
release. It reports a very little number of issues so they are fix it in
this commit.

Change-Id: I74fef4779c3f592aae19103fd9f70103586fe24e
This commit is contained in:
Ivan Fraixedes 2020-01-22 16:38:56 +01:00 committed by Ivan Fraixedes
parent f917fecc61
commit f5c9597d29
2 changed files with 36 additions and 34 deletions

View File

@ -10,41 +10,43 @@ run:
linters:
enable:
- govet # check standard vet rules
- golint # check standard linting rules
- staticcheck # comprehensive checks
- errcheck # find unchecked errors
- ineffassign # find ineffective assignments
- varcheck # find unused global variables and constants
- structcheck # check for unused struct parameters
- deadcode # find code that is not used
- bodyclose # find unclosed http response bodies
- nakedret # check for naked returns
- gofmt # sanity check formatting
- misspell # check spelling
- unconvert # remove unnecessary conversions
- scopelint # checks for unpinned variables
- gocritic # checks for style, performance issues, and common programming errors
- dogsled # checks for too many ignored arguments
#TODO#- whitespace # checks for leading/trailing newlines
#TODO#- unparam # check for unused parameters
#TODO#- maligned # check for better memory usage
#TODO#- prealloc # easy optimizations
- govet # check standard vet rules
- golint # check standard linting rules
- staticcheck # comprehensive checks
- errcheck # find unchecked errors
- ineffassign # find ineffective assignments
- varcheck # find unused global variables and constants
- structcheck # check for unused struct parameters
- deadcode # find code that is not used
- bodyclose # find unclosed http response bodies
- nakedret # check for naked returns
- gofmt # sanity check formatting
- misspell # check spelling
- unconvert # remove unnecessary conversions
- scopelint # checks for unpinned variables
- gocritic # checks for style, performance issues, and common programming errors
- dogsled # checks for too many ignored arguments
- goprintffuncname # Checks that printf-like functions are named with `f` at the end [fast: true, auto-fix: false]
#TODO#- whitespace # checks for leading/trailing newlines
#TODO#- unparam # check for unused parameters
#TODO#- maligned # check for better memory usage
#TODO#- prealloc # easy optimizations
#TODO#- gosec
disable:
- godox
- wsl # too much noise
- goimports # disabled, because it's slow, using scripts/check-imports.go instead.
- goconst # check for things that could be replaced by constants
- gocyclo # needs tweaking
- depguard # unused
- gosec # needs tweaking
- stylecheck # has false positives
- dupl # slow
- interfacer # not that useful
- gosimple # part of staticcheck
- unused # part of staticcheck
- wsl # too much noise
- goimports # disabled, because it's slow, using scripts/check-imports.go instead.
- goconst # check for things that could be replaced by constants
- gocyclo # needs tweaking
- depguard # unused
- gosec # needs tweaking
- stylecheck # has false positives
- dupl # slow
- interfacer # not that useful
- gosimple # part of staticcheck
- unused # part of staticcheck
- lll
- rowserrcheck # checks if sql.Rows.Err is checked correctly - Disabled because it reports false positive with defer statements after Query call
fast: false
output:

View File

@ -17,8 +17,8 @@ var ErrValidation = errs.Class("validation error")
// validationError is slice of ErrValidation class errors
type validationErrors []error
// Add new ErrValidation err
func (validation *validationErrors) Add(format string, args ...interface{}) {
// Addf adds a new ErrValidation error to validation.
func (validation *validationErrors) Addf(format string, args ...interface{}) {
*validation = append(*validation, ErrValidation.New(format, args...))
}
@ -37,7 +37,7 @@ func ValidatePassword(pass string) error {
var errs validationErrors
if len(pass) < passMinLength {
errs.Add(passwordIncorrectErrMsg, passMinLength)
errs.Addf(passwordIncorrectErrMsg, passMinLength)
}
return errs.Combine()