aboutsummaryrefslogtreecommitdiff
path: root/internal/lsp/cache
diff options
context:
space:
mode:
authorRobert Findley <rfindley@google.com>2022-07-11 16:55:34 -0400
committerRobert Findley <rfindley@google.com>2022-07-12 14:39:19 +0000
commita5adb0f2c2ab868ee0a7594bfd8432fc55545285 (patch)
treeac048653fc33f7c28b9df1bb2105dc924fe694c1 /internal/lsp/cache
parenta79ee0f0f02a90ce00bfd721fae9d2d154cb7568 (diff)
downloadgolang-x-tools-a5adb0f2c2ab868ee0a7594bfd8432fc55545285.tar.gz
internal/lsp/cache: use mod=readonly for process env funcs
CL 416874 changed the logic of populateProcessEnv and incorrectly removed a write of ProcessEnv.ModFlag. We should explicitly set -mod=readonly. Change-Id: Ibacf3d4b4c0c978d65fde345741945d6136db159 Reviewed-on: https://go-review.googlesource.com/c/tools/+/416877 Reviewed-by: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Robert Findley <rfindley@google.com>
Diffstat (limited to 'internal/lsp/cache')
-rw-r--r--internal/lsp/cache/imports.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/internal/lsp/cache/imports.go b/internal/lsp/cache/imports.go
index 7877c4f07..a08953db6 100644
--- a/internal/lsp/cache/imports.go
+++ b/internal/lsp/cache/imports.go
@@ -156,6 +156,7 @@ func (s *importsState) populateProcessEnv(ctx context.Context, snapshot *snapsho
}
pe.BuildFlags = inv.BuildFlags
+ pe.ModFlag = "readonly" // processEnv operations should not mutate the modfile
pe.Env = map[string]string{}
for _, kv := range inv.Env {
split := strings.SplitN(kv, "=", 2)