Skip to content

x/tools/gopls: invoking go version causes a crash on Windows #38062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
inliquid opened this issue Mar 25, 2020 · 4 comments
Closed

x/tools/gopls: invoking go version causes a crash on Windows #38062

inliquid opened this issue Mar 25, 2020 · 4 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@inliquid
Copy link

  1. go1.14
  2. VS Code

Today, after upgrade to latest from master, gopls started to crash with the error:
panic: err: exit status 1: stderr: go: creating work dir: mkdir C:\Windows\go-build728148707: Access is denied.

Previous version was compiled smth like ~1-2 days ago, so it's recent change.

C:\Users\***>echo %TMP%
C:\Users\***\AppData\Local\Temp

C:\Users\***>echo %TEMP%
C:\Users\***\AppData\Local\Temp
@gopherbot gopherbot added this to the Unreleased milestone Mar 25, 2020
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Mar 25, 2020
@golang golang deleted a comment from gopherbot Mar 25, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.4.0 Mar 25, 2020
@stamblerre stamblerre changed the title x/tools/gopls: recent change make gopls crash on Windows x/tools/gopls: invoking go version causes a crash on Windows Mar 25, 2020
@stamblerre
Copy link
Contributor

Thanks for the report! I am able to reproduce the crash on Windows. It's caused by https://golang.org/cl/225137 - specifically by calling go version in golang.org/x/tools/internal/lsp/debug/info.go. Probably we have to set a different working directory for the command? I'll take a look today.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/225817 mentions this issue: internal/gocommand: only set working dir if it's not empty

@inliquid
Copy link
Author

Problem is still there...

@stamblerre stamblerre reopened this Mar 30, 2020
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/226370 mentions this issue: internal/gocommand: fix environment on Windows

@golang golang locked and limited conversation to collaborators Mar 30, 2021
apstndb pushed a commit to apstndb/gotoolsdiff that referenced this issue Jan 11, 2025
This was causing crashes by setting the working directory to be empty.

Fixes golang/go#38062
Fixes golang/go#38101

Change-Id: I6d679ee1d5dcab914df3d565d83aa6de0dd74cb4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/225817
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
apstndb pushed a commit to apstndb/gotoolsdiff that referenced this issue Jan 11, 2025
Seems like os.Environ() is necessary after all. My bad for not testing
my earlier change on Windows. I'm not able to reproduce the behavior
in my test, so it's not really testing the crash correctly.

Fixes golang/go#38062

Change-Id: Ied45bbf572023a9dcd5d020db49bf3e95c824602
Reviewed-on: https://go-review.googlesource.com/c/tools/+/226370
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants