On Wed, Nov 30, 2016 at 9:47 AM, Craig Peterson
<
peterso...@gmail.com> wrote:
>
> This feels like unnecessary boilerplate to me. Can anyone explain what are
> the technical reasons for requiring a main package? Could the compiler not
> generate a main package shim like this if you try to build a library package
> with -buildmode=plugin ?
The technical limitation is that there needs to be an entry point that
will run all the initializers. And, we want to permit a plugin to
include multiple unrelated packages, so there needs to be a single
point that lists them all.
The same issue arises for -buildmode=c-archive and c-shared.
We could arrange for the go tool (probably not the compiler itself) to
optionally auto-generate a main package. Want to write a patch?
Ian