How to enable CGO for one module only


(Lingfeng Huang) #1

My project was working fine with CGO_ENABLED=0.
Now for a new requirement, I need to import a module, the new module imports C and requires CGO enabled. Is there a way to only enable CGO for this new module during go build?

Making CGO_ENABLED=1 for the whole project caused problem in my container - standard_init_linux.go:178: exec user process caused "no such file or directory"

Any help is appreciated!