Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
x/tools/go/packages: high CPU usage while processing cgo file #32821
What version of Go are you using (
When requesting source in go/packages, we always return the cgo-processed source code. That's where we chose to draw the abstraction boundary. So I don't think there's too much we can do from the go/packages side. We're going to have to run go list -compiled, and once go list runs, go/packages does minimal work to copy the outputs of go/packages into the Packages struct it returns in a Load call (since we don't need to do parsing/typechecking/etc).
The one strange thing is that it's my understanding that the LSP gets the package information only once (unless new packages are opened) so there shouldn't be consistent high cpu usage.