mirror of
https://github.com/mgechev/revive.git
synced 2025-11-27 22:18:41 +02:00
Co-authored-by: SalvadorC <salvadorcavadini+github@gmail.com>
This commit is contained in:
@@ -105,6 +105,9 @@ func (w lintErrorStrings) match(expr *ast.CallExpr) bool {
|
|||||||
}
|
}
|
||||||
// retrieve the package
|
// retrieve the package
|
||||||
id, ok := sel.X.(*ast.Ident)
|
id, ok := sel.X.(*ast.Ident)
|
||||||
|
if !ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
functions, ok := w.errorFunctions[id.Name]
|
functions, ok := w.errorFunctions[id.Name]
|
||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
|
|||||||
4
testdata/golint/error-strings.go
vendored
4
testdata/golint/error-strings.go
vendored
@@ -16,5 +16,9 @@ func g(x int) error {
|
|||||||
err = fmt.Errorf("Newlines are really fun\n") // MATCH /error strings should not be capitalized or end with punctuation or a newline/
|
err = fmt.Errorf("Newlines are really fun\n") // MATCH /error strings should not be capitalized or end with punctuation or a newline/
|
||||||
err = errors.New(`too much stuff.`) // MATCH /error strings should not be capitalized or end with punctuation or a newline/
|
err = errors.New(`too much stuff.`) // MATCH /error strings should not be capitalized or end with punctuation or a newline/
|
||||||
err = errors.New("This %d is too low", x) // MATCH /error strings should not be capitalized or end with punctuation or a newline/
|
err = errors.New("This %d is too low", x) // MATCH /error strings should not be capitalized or end with punctuation or a newline/
|
||||||
|
|
||||||
|
// Non-regression test for issue #610
|
||||||
|
d.stack.Push(from)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user