I have a ‘legal’ requirement to build a Go module to produce an executable and all of its dependencies as a single .so. The exe contains our private Go code and dynamically link to open source packages as as single .so
Possible? how?
I am using Go 1.12.7 with GO111MODULE=on on SLES12
I saw that post as well, and it not making sense to me may be you can show a way to create a shared lib ( .so) against downloaded dependencies under GOPATH/pkg/mod?
Ok, I don’t know what could be messed with gomod but in first place, I would follow this article just to check what happens. So I’d follow the instructions given :
As you can see, the code has to be part of the main package, with an empty main function. The C package has to be imported. Exported functions must have the export annotation
And then build with
go build -o libimgutil.so -buildmode=c-shared yourfile.go
just want to ping this group again, is there a way for me to build my own Go source and dynamically link to my thirdparties package produce by c-shared?