Skip to content

Commit

Permalink
internal/lsp: don't show diagnostic in go.mod for direct dependencies
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stamblerre committed Jul 29, 2020
1 parent 449c585 commit 8afe7e0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions internal/lsp/cache/mod_tidy.go
Expand Up @@ -424,8 +424,12 @@ func missingModuleErrors(ctx context.Context, snapshot *snapshot, modMapper *pro
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 @@ -445,8 +449,7 @@ func missingModuleErrors(ctx context.Context, snapshot *snapshot, modMapper *pro
}
}
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 8afe7e0

Please sign in to comment.