Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

The following go flags let you build statically-linked cgo binaries, provided that all the C libraries that you're using support static linking and don't call the NSS functions in glibc:

-tags netgo,osusergo -linkmode external -extldflags -static

I regularly compile (cross-compile, even) static Go binaries that use the cgo sqlite package. But it's certainly a lot simpler if you can avoid cgo.

 help



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: