Distributing Go bindings: Go plugin vs Go archive vs Go shared package

84 views
Skip to first unread message

ju...@sqreen.io

unread,
Sep 10, 2019, 8:39:48 AM9/10/19
to golang-nuts
Hello!

I am trying to find out the best way to distribute Go bindings to a C library. I would like to avoid asking my users to install their target gcc because of cgo. So my idea is to avoid cgo by avoiding having my user compiling the bindings, by therefore distributing an already compiled package for every target GOOS and GOARCH.

Some discussions on Go plugins I found are about this precise case but it is not supported on Windows so far. 
But I really don't get why isn't it possible to simply use the archive build mode `-buildmode archive` on the bindings, then include the resulting Go package archive in the repo, and simply use some go CLI option in order to use the correct archive for the target GOOS/GOARCH?

I couldn't find out how to pass such option to the go compiler so far, so I was hoping for some help.

Thanks for your help,
Julio
Reply all
Reply to author
Forward
0 new messages