Skip to content

Commit 1fe6e2b

Browse files
ethanalee-workgopherbot
authored andcommitted
gopls/internal/server: modify checkGoModDeps condition
- checkGoModDeps should only be run once per file. Change-Id: Ia3df152240c36843507936eddf16a560c82b5a4b Reviewed-on: https://go-review.googlesource.com/c/tools/+/730163 Reviewed-by: Hongxiang Jiang <hxjiang@golang.org> Auto-Submit: Ethan Lee <ethanalee@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent 995ffe4 commit 1fe6e2b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

gopls/internal/server/text_synchronization.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,16 @@ func (s *server) didModifyFiles(ctx context.Context, modifications []file.Modifi
254254
// to their files.
255255
modifications = s.session.ExpandModificationsToDirectories(ctx, modifications)
256256

257+
// TODO: also handle go.work changes as well.
258+
uris := make(map[protocol.DocumentURI]struct{})
257259
for _, m := range modifications {
258-
// TODO: also handle go.work changes as well.
259-
if strings.HasSuffix(m.URI.Path(), "go.mod") {
260-
if m.Action == file.Create || m.Action == file.Change {
261-
s.checkGoModDeps(ctx, m.URI)
262-
}
260+
if strings.HasSuffix(m.URI.Path(), "go.mod") && (m.Action == file.Create || m.Action == file.Change) {
261+
uris[m.URI] = struct{}{}
263262
}
264263
}
264+
for uri := range uris {
265+
s.checkGoModDeps(ctx, uri)
266+
}
265267

266268
viewsToDiagnose, err := s.session.DidModifyFiles(ctx, modifications)
267269
if err != nil {

0 commit comments

Comments
 (0)