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

adding cgo parameter flag #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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.

None yet

1 participant