Skip to content

Install gopls with CGO disabled #3088

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
hyangah opened this issue Dec 13, 2023 · 5 comments
Closed

Install gopls with CGO disabled #3088

hyangah opened this issue Dec 13, 2023 · 5 comments

Comments

@hyangah
Copy link
Contributor

hyangah commented Dec 13, 2023

Cgo is unnecessary to build gopls (and probably some of other tools).
Disable cgo (CGO_ENABLED=0), to avoid crashes (#3085, #3039, golang/go#63997) caused by misconfigured C toolchain.

@hyangah hyangah added this to the v0.41.0 milestone Dec 13, 2023
@hyangah
Copy link
Contributor Author

hyangah commented Dec 13, 2023

I think most tools VS Code Go depends on don't need CGO.
(@derekparker @aarzilli Is it ok to use dlv compiled with CGO_ENABLED=0?)

@hyangah
Copy link
Contributor Author

hyangah commented Dec 13, 2023

From my mac,

$ go list -f '{{if .CgoFiles}}{{.ImportPath}}{{end}}' -deps ./cmd/dlv
runtime/cgo
net

I think disabling CGO will be ok.

@aarzilli
Copy link
Contributor

It should be fine everywhere except freebsd.

@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/549245 mentions this issue: src/goEnv: disable Cgo when building tools

@hyangah
Copy link
Contributor Author

hyangah commented Dec 14, 2023

According to @findleyr, gopls's CGO dependency was real (fastwalk). The dependency is removed from the dev branch so once gopls v0.15 is released next year, this problem will go away.
Delve and other tools don't have CGO dependency, so the go command won't rely on the CGO and we don't need to worry about it.

I will abandon the cl.

@hyangah hyangah closed this as not planned Won't fix, can't repro, duplicate, stale Dec 14, 2023
@hyangah hyangah modified the milestones: v0.41.0, vscode-go/unplanned Dec 14, 2023
@golang golang locked and limited conversation to collaborators Dec 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants