aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/bombsimon
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-09-15 18:05:35 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-09-15 19:34:30 +0200
commit712de1c63d9db97c81af68cd0dc4372c53d2e57a (patch)
treeae1761fec52c3ae4ddd003a4130ddbda8d0a2d69 /vendor/github.com/bombsimon
parent298a69c38dd5c8a9bbd7a022e88f4ddbcf885e16 (diff)
vendor/github.com/golangci/golangci-lint: update to v1.31
Diffstat (limited to 'vendor/github.com/bombsimon')
-rw-r--r--vendor/github.com/bombsimon/wsl/v3/wsl.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/vendor/github.com/bombsimon/wsl/v3/wsl.go b/vendor/github.com/bombsimon/wsl/v3/wsl.go
index 3b4a4e9a1..31520fb43 100644
--- a/vendor/github.com/bombsimon/wsl/v3/wsl.go
+++ b/vendor/github.com/bombsimon/wsl/v3/wsl.go
@@ -398,6 +398,18 @@ func (p *Processor) parseBlockStatements(statements []ast.Stmt) {
if !cuddledWithLastStmt {
checkingErr := atLeastOneInListsMatch(rightAndLeftHandSide, p.config.ErrorVariableNames)
if checkingErr {
+ // We only want to enforce cuddling error checks if the
+ // error was assigned on the line above. See
+ // https://github.com/bombsimon/wsl/issues/78.
+ // This is needed since `assignedOnLineAbove` is not
+ // actually just assignments but everything from LHS in the
+ // previous statement. This means that if previous line was
+ // `if err ...`, `err` will now be in the list
+ // `assignedOnLineAbove`.
+ if _, ok := previousStatement.(*ast.AssignStmt); !ok {
+ continue
+ }
+
if checkingErrInitializedInline() {
continue
}