You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support configuring CGO_ENABLED when install go_install and go_build packages.
Why is the feature needed?
The cgo tool is enabled by default for native builds on systems where it is expected to work.
It is disabled by default when cross-compiling as well as when the CC environment variable is unset and the default C compiler (typically gcc or clang) cannot be found on the system PATH.
You can override the default by setting the CGO_ENABLED environment variable when running the go tool: set it to 1 to enable the use of cgo, and to 0 to disable it.
The go tool will set the build constraint "cgo" if cgo is enabled.
The special import "C" implies the "cgo" build constraint, as though the file also said "//go:build cgo".
Therefore, if cgo is disabled, files that import "C" will not be built by the go tool.
(For more about build constraints see https://golang.org/pkg/go/build/#hdr-Build_Constraints).
Example Code
No response
Note
⚠️ This issue is just an idea.
I haven't considered it seriously yet.
I think this is rarely necessary.
The text was updated successfully, but these errors were encountered:
Feature Overview
Support configuring CGO_ENABLED when install go_install and go_build packages.
Why is the feature needed?
Example Code
No response
Note
I haven't considered it seriously yet.
I think this is rarely necessary.
The text was updated successfully, but these errors were encountered: