From 59e246924e48c1a2be288541d01b39762831ca61 Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Mon, 3 Feb 2020 20:18:59 -0500 Subject: [PATCH] internal/lsp/cache: use snapshot ID and view folder in ModTidyHandle key Just to be safe, the snapshot ID and view's folder should be enough to uniquely identify the ModTidyHandle. Change-Id: Ie3a0dc64bf16bcc8e4eb75af107481c07de81967 Reviewed-on: https://go-review.googlesource.com/c/tools/+/217657 Run-TryBot: Rebecca Stambler TryBot-Result: Gobot Gobot Reviewed-by: Heschi Kreinick --- internal/lsp/cache/mod_tidy.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/lsp/cache/mod_tidy.go b/internal/lsp/cache/mod_tidy.go index e301245b1c..b7730cff85 100644 --- a/internal/lsp/cache/mod_tidy.go +++ b/internal/lsp/cache/mod_tidy.go @@ -29,8 +29,9 @@ const ModTidyError = "go mod tidy" const SyntaxError = "syntax" type parseModKey struct { - snapshot source.Snapshot - cfg string + view string + snapshotID uint64 + cfg string } type modTidyHandle struct { @@ -96,8 +97,9 @@ func (s *snapshot) ModTidyHandle(ctx context.Context, realfh source.FileHandle) folder := s.View().Folder().Filename() key := parseModKey{ - snapshot: s, - cfg: hashConfig(cfg), + view: folder, + snapshotID: s.ID(), + cfg: hashConfig(cfg), } h := s.view.session.cache.store.Bind(key, func(ctx context.Context) interface{} { data := &modTidyData{}