[tools] gopls/internal/server: fix vulncheck test

0 views
Skip to first unread message

Madeline Kalil (Gerrit)

unread,
Jun 5, 2026, 10:04:47 AM (2 days ago) Jun 5
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Alan Donovan, golang...@luci-project-accounts.iam.gserviceaccount.com, Ethan Lee, golang-co...@googlegroups.com

Madeline Kalil submitted the change

Change information

Commit message:
gopls/internal/server: fix vulncheck test

On Windows, os.UserConfigDir() relies on the %APPDATA% environment
variable, whereas on Unix it depends on $HOME. The vulncheck prompt
tests previously attempted to sandbox the configuration directory
by overriding $HOME with t.TempDir(), which had no effect on Windows.
This caused the tests on Windows builders to read and write to the
real user's AppData directory, leading to errors like:
"mkdir C:\Users\runneradmin\AppData: Cannot create a file when that
file already exists."
Fix this by having vulncheckFilename honor GOPLS_CONFIG_DIR, similar
to telemetry prompts. The tests are updated to override this variable
with t.TempDir() and remove the manual cleanup block, which is now
redundant since the test runner cleans up t.TempDir() automatically.

Fixes golang/go#79818
Change-Id: I984d995ab4c8f1e98b13d9e9e47c7a42e56d1063
Reviewed-by: Alan Donovan <adon...@google.com>
Files:
  • M gopls/internal/server/vulncheck_prompt.go
  • M gopls/internal/server/vulncheck_prompt_test.go
Change size: S
Delta: 2 files changed, 8 insertions(+), 22 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I984d995ab4c8f1e98b13d9e9e47c7a42e56d1063
Gerrit-Change-Number: 787120
Gerrit-PatchSet: 3
Gerrit-Owner: Madeline Kalil <mka...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Ethan Lee <etha...@google.com>
Gerrit-Reviewer: Madeline Kalil <mka...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages