Hi all,

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 
<https://github.com/golang/go/blob/59bfc18e3441d9cd0b1b2f302935403bbf52ac8b/src/cmd/go/internal/work/exec.go#L2174>
.

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 
<https://github.com/nevkontakte/gopherjs-plus/tree/tools>, 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.
2) Using toolexec to intercept the calls works, but I assume this isn't 
it's intended purpose. I see no problem with using it, maybe I'm missing 
something?
3) Sort of related to #2, go tool would still check for supported 
GOOS/GOARCH pair, which is irrelevant to third-party compilers.

Cheers,
Alex.

-- 
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/4163ac21-435b-4186-966e-5d1f8f20d200n%40googlegroups.com.

Reply via email to