1
0
mirror of https://github.com/golang/go synced 2024-10-01 01:28:32 -06:00

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 <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
Rebecca Stambler 2020-02-03 20:18:59 -05:00
parent cf5ba95194
commit 59e246924e

View File

@ -29,7 +29,8 @@ const ModTidyError = "go mod tidy"
const SyntaxError = "syntax"
type parseModKey struct {
snapshot source.Snapshot
view string
snapshotID uint64
cfg string
}
@ -96,7 +97,8 @@ func (s *snapshot) ModTidyHandle(ctx context.Context, realfh source.FileHandle)
folder := s.View().Folder().Filename()
key := parseModKey{
snapshot: s,
view: folder,
snapshotID: s.ID(),
cfg: hashConfig(cfg),
}
h := s.view.session.cache.store.Bind(key, func(ctx context.Context) interface{} {