From 4da8ceb6f1ad02b6af00ed2d8d62df1d56a07d2f Mon Sep 17 00:00:00 2001 From: Robert Findley Date: Mon, 31 Jan 2022 15:47:29 -0500 Subject: [PATCH] internal/lsp/source: remove the unused UpdateUserModFile invocation flag Change-Id: I4325417e4d97d3ab82551c2fa0382aa3d962a781 Reviewed-on: https://go-review.googlesource.com/c/tools/+/382077 Trust: Robert Findley Run-TryBot: Robert Findley TryBot-Result: Gopher Robot Reviewed-by: Michael Matloob gopls-CI: kokoro --- internal/lsp/cache/snapshot.go | 5 ++--- internal/lsp/source/view.go | 3 --- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/internal/lsp/cache/snapshot.go b/internal/lsp/cache/snapshot.go index edcb5213e55..1dd3339e8e8 100644 --- a/internal/lsp/cache/snapshot.go +++ b/internal/lsp/cache/snapshot.go @@ -391,14 +391,13 @@ func (s *snapshot) goCommandInvocation(ctx context.Context, flags source.Invocat } else { inv.ModFlag = mutableModFlag } - case source.UpdateUserModFile, source.WriteTemporaryModFile: + case source.WriteTemporaryModFile: inv.ModFlag = mutableModFlag } } - wantTempMod := mode != source.UpdateUserModFile needTempMod := mode == source.WriteTemporaryModFile - tempMod := wantTempMod && s.workspaceMode()&tempModfile != 0 + tempMod := s.workspaceMode()&tempModfile != 0 if needTempMod && !tempMod { return "", nil, cleanup, source.ErrTmpModfileUnsupported } diff --git a/internal/lsp/source/view.go b/internal/lsp/source/view.go index 906d45fc0e1..e7120ec5af2 100644 --- a/internal/lsp/source/view.go +++ b/internal/lsp/source/view.go @@ -201,9 +201,6 @@ const ( // Normal is appropriate for commands that might be run by a user and don't // deliberately modify go.mod files, e.g. `go test`. Normal InvocationFlags = iota - // UpdateUserModFile is for commands that intend to update the user's real - // go.mod file, e.g. `go mod tidy` in response to a user's request to tidy. - UpdateUserModFile // WriteTemporaryModFile is for commands that need information from a // modified version of the user's go.mod file, e.g. `go mod tidy` used to // generate diagnostics.