On Mon, Jan 11, 2021 at 11:03 AM Alexander Zhirov <al...@nevkontakte.com> wrote:
>
> At the moment there are at least three alternative implementations of Go that 
> I know of (and there are probably some I don't): gccgo, tinygo and gopherjs. 
> Of the three, only gccgo is supported by the go tool out of box. Looking at 
> the source code, gc ang gccgo have their own implementations of the toolchain 
> interface.
>
> The other two essentially reimplement the built system using go/build 
> package, and, based on my experience with GopherJS, keeping up with changes 
> to the upstream Go build tooling (modules, file embedding, etc.) is a lot of 
> effort.
>
> Out of interest, I was investigating what would it take for GopherJS to 
> delegate build system details to the Go tool and only provide alternative 
> implementations of compile/link tools. For prototyping purposes -toolexec 
> flag allows me to insert a proxy that intercepts compiler/linker invocations 
> and invokes GopherJS as required. The nice thing is that no GopherJS-specific 
> code needs to exist in the cmd/go codebase.
>
>  I'm currently at a very early stage, but it seems to be working out. Before 
> I spend too much time though, I'd like to probe people's opinions of a few 
> questions:
>
> 1) Is the idea of treating cmd/compile, cmd/link (and so on) interfaces as an 
> extension point a reasonable one? I expect that they are going to change 
> between releases, but probably fewer than the build system as a whole.

I suspect this will give you trouble over time.  When the go tool
invokes cmd/compile and cmd/link, it expects them to behave just like
the ordinary cmd/compile and cmd/link commands.  For example, it
expects cmd/link to create a build ID that can be recognized by
cmd/internal/buildid.  It expects to be able to pack additional
objects into archive files (see packInternal in
cmd/go/internal/work/gc.go).  There may be other complex dependencies,
and certainly more will be added over time.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXpU6A0K5w%3DgN5B_UBtxMXBzpdhu9-UDo55%3Dzab8Jfj-w%40mail.gmail.com.

Reply via email to