Whether CGO is enabled or not affects how reliable certain standard library functions are. For example, os/user.LookupGroupId is untrustworthy if CGO is not enabled (
example 1,
example 2).
I can use build flags and two separate source files to determine whether CGO is enabled or not, for example
in this commit.
This feels like it should be part of runtime, like runtime.GOOS and runtime.GOARCH.
Is there a better way to determine whether CGO is enabled?
Cheers,
Tom