About build Go Archive

469 views
Skip to first unread message

w1252...@gmail.com

unread,
Aug 28, 2019, 8:53:19 AM8/28/19
to golang-nuts
As we know, Go 1.13 will drop support for binary-only packages. it seems we have to use buildmode=plugin/archive if we want to build go archive to provide to others.

when I try go buildmode=archive or buildmode=shared(go 1.12, go module project), it throw error like cannot use packages ... from different roots, i want to ask if i do something wrong, or it can't support well with 1.12? 

thanks a lot.

Ian Lance Taylor

unread,
Aug 28, 2019, 10:36:31 AM8/28/19
to w1252...@gmail.com, golang-nuts
On Wed, Aug 28, 2019 at 5:53 AM <w1252...@gmail.com> wrote:
>
> As we know, Go 1.13 will drop support for binary-only packages. it seems we have to use buildmode=plugin/archive if we want to build go archive to provide to others.
>
> when I try go buildmode=archive or buildmode=shared(go 1.12, go module project), it throw error like cannot use packages ... from different roots, i want to ask if i do something wrong, or it can't support well with 1.12?

Using -buildmode=archive or -buildmode=shared isn't a way to step
around the restrictions on binary packages. Now that support for
binary packages has been removed, the "go build" process inherently
expects to be able to see the source code of a package.

Ian

Jack Wang

unread,
Sep 6, 2019, 5:05:44 AM9/6/19
to golang-nuts
But I can use -buildmod=plugin to generate a "ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked", and it can be used. I want to konw if it's the only way to generate a binary package and the builmode=archive/shared not work anymore.

在 2019年8月28日星期三 UTC+8下午10:36:31,Ian Lance Taylor写道:

Ian Lance Taylor

unread,
Sep 6, 2019, 1:38:01 PM9/6/19
to Jack Wang, golang-nuts
On Fri, Sep 6, 2019 at 2:05 AM Jack Wang <w1252...@gmail.com> wrote:
>
> But I can use -buildmod=plugin to generate a "ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked", and it can be used. I want to konw if it's the only way to generate a binary package and the builmode=archive/shared not work anymore.

If I understand you correctly, the answer is yes. See
https://golang.org/doc/go1.12#binary-only and
https://golang.org/doc/go1.13#go-command .

Ian
Reply all
Reply to author
Forward
0 new messages