1
0
mirror of https://github.com/golang/go synced 2024-11-18 14:54:40 -07:00

internal/lsp/cache: fix ineffectual err assignment

The `if err :=` block creates a shadow err value that is then discarded
after the block.

Change-Id: I78f6a7298ac5d3d86ece056a9e328bcee9fdc683

Change-Id: I78f6a7298ac5d3d86ece056a9e328bcee9fdc683
GitHub-Last-Rev: 4bac8fb982fa3a0724206422b1a4dbc5e41c34a9
GitHub-Pull-Request: golang/tools#114
Reviewed-on: https://go-review.googlesource.com/c/tools/+/181777
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
Edward Muller 2019-06-14 20:32:31 +00:00 committed by Rebecca Stambler
parent 97de5656fd
commit 7653e6d3d5

View File

@ -232,7 +232,8 @@ func fix(ctx context.Context, file *ast.File, tok *token.File, src []byte) error
}
switch n := n.(type) {
case *ast.BadStmt:
if err := parseDeferOrGoStmt(n, parent, tok, src); err != nil {
err = parseDeferOrGoStmt(n, parent, tok, src) // don't shadow err
if err != nil {
err = fmt.Errorf("unable to parse defer or go from *ast.BadStmt: %v", err)
}
return false