Skip to content

Commit

Permalink
[gopls-release-branch.0.4] internal/lsp: don't show diagnostic in go.…
Browse files Browse the repository at this point in the history
…mod for direct dependencies

Fixes golang/go#40470.

Change-Id: I4831b837e6db5cc344c20480abde1e688ddab0dc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/245537
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
(cherry picked from commit 8afe7e0)
Reviewed-on: https://go-review.googlesource.com/c/tools/+/245541
  • Loading branch information
stamblerre committed Jul 29, 2020
1 parent dc9b9f8 commit 8bac6fa
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions internal/lsp/cache/mod_tidy.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,12 @@ func missingModuleErrors(ctx context.Context, fset *token.FileSet, modMapper *pr
for _, pkg := range pkgs {
missingPkgs := map[string]*modfile.Require{}
for _, imp := range pkg.Imports() {
if req, ok := missingMods[imp.PkgPath()]; ok {
found := func(req *modfile.Require) {
missingPkgs[imp.PkgPath()] = req
matchedMissingMods[req] = struct{}{}
}
if req, ok := missingMods[imp.PkgPath()]; ok {
found(req)
break
}
// If the import is a package of the dependency, then add the
Expand All @@ -457,8 +461,7 @@ func missingModuleErrors(ctx context.Context, fset *token.FileSet, modMapper *pr
}
}
if req, ok := missingMods[match]; ok {
missingPkgs[imp.PkgPath()] = req
matchedMissingMods[req] = struct{}{}
found(req)
}
}
if len(missingPkgs) > 0 {
Expand Down

0 comments on commit 8bac6fa

Please sign in to comment.