Skip to content

Conversation

@mplachter
Copy link

@mplachter mplachter commented Jul 27, 2021

Go by default will build with CGO enabled when building on native systems where it is expected to work.
https://pkg.go.dev/cmd/cgo#:~:text=The%20cgo%20tool%20is%20enabled,to%200%20to%20disable%20it.

I would like to add a parameter flag which will disable CGO when building no matter if it could be supported natively.

This is useful when building artifacts that will not run on systems that will not have the c bindings present for example docker containers running binaries.

@mplachter
Copy link
Author

mplachter commented Jul 27, 2021

Added second commit can squash later.

First commit actually changed the default behavior of go build as it would either set CGO to be on or off where in the default it is only on for the binary if the system building it matches the build architecture and system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant