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>
This commit is contained in:
Robert Findley 2022-07-11 16:55:34 -04:00
parent a79ee0f0f0
commit a5adb0f2c2
1 changed files with 1 additions and 0 deletions

View File

@ -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)