go2hx

warning: experimental version.

Compile Go to Haxe.

Use Go libs with ease!

Get started!

Samples

Manual

Progress Graph!

Standard Library compatibility/api docs
modulehlinterpjs
unicode
unicode/utf8
unicode/utf16
math❌ log
math/bits❌ log
math/big❌ log❌ log❌ log
math/rand❌ log❌ log❌ log
sort
strings❌ log
flag❌ log❌ log❌ log
io❌ log❌ log❌ log
io/fs❌ log❌ log❌ log
testing/fstest❌ log❌ log❌ log
testing/iotest❌ log❌ log❌ log
os❌ log❌ log❌ log
os/exec❌ log❌ log❌ log
syscall❌ log❌ log❌ log
syscall/js❌ log❌ log❌ log
log❌ log❌ log❌ log
bytes❌ log
time❌ log❌ log❌ log
path
strconv❌ log
errors
runtime❌ log❌ log❌ log
runtime/debug❌ log❌ log❌ log
encoding/base64❌ log
encoding❌ log❌ log❌ log
bufio❌ log❌ log❌ log
regexp❌ log❌ log❌ log
regexp/syntax
encoding/binary❌ log❌ log❌ log
encoding/base64❌ log
reflect❌ log❌ log❌ log
math/cmplx❌ log❌ log❌ log
sync/atomic❌ log❌ log❌ log
slices❌ log❌ log❌ log
sync❌ log❌ log❌ log
text/scanner
testing/quick❌ log❌ log❌ log
hash
crypto/sha1❌ log❌ log❌ log
crypto/rand❌ log❌ log❌ log
fmt❌ log❌ log❌ log
go/ast❌ log❌ log❌ log
go/types❌ log❌ log❌ log
go/token❌ log❌ log❌ log
go/printer❌ log❌ log❌ log
go/constant❌ log❌ log❌ log
crypto❌ log❌ log❌ log
go/importer❌ log❌ log❌ log
hash/adler32❌ log
path/filepath❌ log❌ log❌ log
compress/bzip2❌ log❌ log❌ log
encoding/hex
image❌ log❌ log❌ log
image/color❌ log❌ log❌ log
text/template❌ log❌ log❌ log
context❌ log❌ log❌ log
encoding/gob❌ log❌ log❌ log
encoding/json❌ log❌ log❌ log
FAQ

Can library X be compiled?

Maybe, to see if the library is supported at the moment go get library_here the library and then run:

go list -f '{{ .Imports }}' library here

Then check to see if the standard libraries used are all passing with the compatibility table above.

Does the compiler support Go as a Haxe target?

No and it's not within the scope of the project.

Why not use externs instead of compiling Go code into Haxe?

Because externs can target lock a code base and they require maintenance, abstraction code etc.

Cgo support?

Not available but planned and happily accepting contributions for it!

How does this compare to Gopherjs or Go wasm?

go2hx's design is built with Haxe devs in mind, therefore the goals align with Haxe dev advantages of the compiler, with that said go2hx does have some advantages already, smaller code generation, access to Haxe's compiler tooling such as dce and optimizations, and Haxe as a language being very portable, high level and statically typed.

What internals does stdlib use?

go2hx's compiler, compiles the standard library packages for example os. After compilation a Patcher system switches out functions/variables/structs for a Haxe equivalent, for example os.Open uses sys.io.File.read and sys.io.File.write.

Contributing:

The project is still at an experimental level, so expect undocumented problems to spring up. The best way to contribute is to simply use the compiler on code you would like and inevitably run into errors. From there we can answer some questions to see:

how to proceed!

What time is the error happening?:

How can the code causing the error be reduced to a simple sample?

println(reflect.TypeOf(value).String())

Does the code throw "not implemented" error?

Is the type casting invalid?

Have issues and/or want to contribute?

github discord