How to build with Golang archive?

Then use archive.

This backs to my first post:

A Golang project xxx/api has been built into an archive file api.a with command: go build -buildmode archive -o api.a a.go b.go
I’d like import package xxx/api and link against the api.a without accessing its source code in another main project. How to do this?

And my answer remains the same.

Provide headerfiles, provide CGO wrapper around the headers. These 2 have to be distributed in source.

Or use plugins.

Or restrict yourself to the go versions that allow for binary packages.

Will it work on cross platforms apps too?

As far as I know, such a bin only package would only work for its own target system. So you had to precompiled for each supported system.

As you can read on the linked GitHub issue, the many unknowns for the target system has been one of the issues why it has been dropped.

This github link you are referring?


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.