Skip to content
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

x/tools/gopls: windows cpu use 100% #66945

Open
dmc-hukaixuan opened this issue Apr 21, 2024 · 1 comment
Open

x/tools/gopls: windows cpu use 100% #66945

dmc-hukaixuan opened this issue Apr 21, 2024 · 1 comment
Labels
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

@dmc-hukaixuan
Copy link

gopls version

0.15.3

go env

set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\dmc\AppData\Local\go-build
set GOENV=C:\Users\dmc\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\dmc\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\dmc\go
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=D:\02-software-install-dir\16-golang
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=D:\02-software-install-dir\16-golang\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.22.2
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=D:\04-dev-code\01-golang\01-dmc-dev\dmc\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\dmc\AppData\Local\Temp\go-build1810198819=/tmp/go-build -gno-record-gcc-switches

What did you do?

I use windows to develop go programs, recently found that my computer is getting slower and slower, when I open vscode, I don't run go run main.go, I just write go code in vscode, when I save the go file, my computer's cpu will suddenly rise to 100%, I don't know what's going on, I can only see that go.exe occupies a very high cpu,

What did you see happen?

when I save the go file, my computer's cpu will suddenly rise to 100%,as shown below

I wonder why: my computer's CPU spikes to 100% when I don't start the go run main.go program, just writing a static go file

70a499e6b59b41ffc772fbc85d9b134

What did you expect to see?

I wish I was writing a go file on window, the cpu wouldn't go up to 100%

Editor and settings

image

Logs

No response

@dmc-hukaixuan dmc-hukaixuan added gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. labels Apr 21, 2024
@seankhliao seankhliao changed the title windows cpu use 100% x/tools/gopls: windows cpu use 100% Apr 21, 2024
@gopherbot gopherbot added this to the Unreleased milestone Apr 21, 2024
@findleyr
Copy link
Contributor

Hi, I would love to get to the bottom of this, but we need more information, which may take a bit of back and forth. In general, the go commands run by VS Code or gopls should be short-lived, and should not be invoked on every save.

Those go commands could be started by gopls to list the workspace. Or they could perhaps be started either directly or indirectly by VS Code. Can you share the command line arguments or parent processes of those go commands, perhaps by using process explorer (https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer)
Sorry if that's not the best way -- I'm not a regular windows user.

Does this reproduce with just a simple workspace folder with, for example, just a main.go file?

@findleyr findleyr modified the milestones: Unreleased, gopls/v0.16.0 Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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