Skip to content

Commit

Permalink
internal/lsp: handle nil pointer exceptions in check for Go files
Browse files Browse the repository at this point in the history
Fixes golang/go#42240

Change-Id: I48382613c9eb9d021a9e1dc9ca6ab6b4b1dfcf8f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/265763
Trust: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
(cherry picked from commit 8cd080b)
Reviewed-on: https://go-review.googlesource.com/c/tools/+/265977
  • Loading branch information
stamblerre committed Oct 28, 2020
1 parent 3b424a5 commit 37f0764
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/lsp/diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,9 @@ func (s *Server) handleFatalErrors(ctx context.Context, snapshot source.Snapshot
// If the folder has no Go code in it, we shouldn't spam the user with a warning.
var hasGo bool
_ = filepath.Walk(snapshot.View().Folder().Filename(), func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if !strings.HasSuffix(info.Name(), ".go") {
return nil
}
Expand Down

0 comments on commit 37f0764

Please sign in to comment.