internal/lsp: fix unnecessary error logging

In internal/lsp/link.go appeared a bug that error message is printed
even if error is not apeared. this commit is fixing this behaviour.

Fixes golang/go#33087

Change-Id: I932546867d78c5c0c3d2c9dabd13287f6837f458
Reviewed-on: https://go-review.googlesource.com/c/tools/+/186037
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
litleleprikon 2019-07-12 21:16:29 +02:00 committed by Rebecca Stambler
parent 128c804424
commit f4b4e63240
1 changed files with 4 additions and 1 deletions

View File

@ -42,7 +42,10 @@ func (s *Server) documentLink(ctx context.Context, params *protocol.DocumentLink
}
target = "https://godoc.org/" + target
l, err := toProtocolLink(view, m, target, n.Pos(), n.End())
view.Session().Logger().Errorf(ctx, "cannot initialize DocumentLink %s: %v", n.Path.Value, err)
if err != nil {
view.Session().Logger().Errorf(ctx, "cannot initialize DocumentLink %s: %v", n.Path.Value, err)
return false
}
links = append(links, l)
return false
case *ast.BasicLit: