go2hx

warning: experimental 0.1.0 version.

Compile Go to Haxe.

Use Go libs with ease!

Stdlib Api

Samples

Manual

In progress tracking graph

Getting started! [link to github README]

Standard Library compatibility/api docs
modulehlinterpjsinfo
bufio❌ error❌ error❌ log 75/79imports
bytesimports
compress/bzip2❌ log 3/4❌ log 3/4❌ log 3/4imports
container/heap❌ error❌ error❌ errorimports
container/list❌ error❌ errorimports
container/ring❌ error❌ errorimports
context❌ error❌ error❌ errorimports
cryptoimports
crypto/aes❌ log 10/13❌ log 10/13❌ log 10/13imports
crypto/cipher❌ log 3/14❌ log 3/14❌ log 3/14imports
crypto/des❌ log 2/18❌ log 6/18❌ log 2/18imports
crypto/md5❌ error❌ error❌ errorimports
crypto/rand❌ error❌ error❌ errorimports
crypto/rc4❌ error❌ error❌ errorimports
crypto/sha1❌ error❌ error❌ errorimports
crypto/sha256❌ error❌ error❌ errorimports
crypto/sha512❌ log 6/8❌ log 6/8❌ log 6/8imports
encoding❌ error❌ error❌ errorimports
encoding/ascii85❌ error❌ errorimports
encoding/base32❌ error❌ error❌ log 21/23imports
encoding/base64❌ log 16/17imports
encoding/base64❌ log 16/17imports
encoding/binary❌ log 4/14❌ log 5/14❌ log 4/11imports
encoding/csv❌ error❌ errorimports
encoding/gob❌ error❌ error❌ errorimports
encoding/heximports
encoding/json❌ error❌ error❌ errorimports
errorsimports
flag❌ error❌ log 16/24❌ errorimports
fmt❌ log 17/22❌ log 17/22❌ log 25/44imports
go/ast❌ error❌ error❌ errorimports
go/constant❌ error❌ error❌ errorimports
go/format❌ error❌ error❌ errorimports
go/importer❌ error❌ error❌ errorimports
go/printer❌ error❌ error❌ errorimports
go/scanner❌ error❌ error❌ errorimports
go/token❌ error❌ error❌ errorimports
go/token❌ error❌ error❌ errorimports
go/types❌ error❌ error❌ errorimports
hashimports
hash/adler32imports
hash/crc32❌ log 7/8❌ log 7/8❌ log 7/8imports
hash/crc64imports
hash/fnv❌ error❌ errorimports
hash/html❌ error❌ error❌ errorimports
image❌ error❌ error❌ errorimports
image/colorimports
image/draw❌ error❌ error❌ errorimports
index/suffixarray❌ error❌ error❌ errorimports
io❌ error❌ error❌ errorimports
io/fs❌ log 13/14❌ log 13/14❌ log 13/14imports
log❌ log 5/9❌ log 5/9❌ log 5/9imports
math❌ log 79/76imports
math/big❌ error❌ error❌ errorimports
math/bits❌ log 23/26imports
math/cmplx❌ log 15/23❌ log 15/24❌ errorimports
math/rand❌ log 12/17❌ log 13/17❌ errorimports
os❌ error❌ error❌ errorimports
os/exec❌ error❌ error❌ errorimports
pathimports
path/filepath❌ log 13/16❌ log 13/16❌ log 12/16imports
reflect❌ error❌ error❌ errorimports
regexp❌ error❌ error❌ errorimports
regexp/syntaximports
runtime❌ error❌ error❌ errorimports
runtime/debug❌ error❌ error❌ errorimports
slices❌ error❌ error❌ errorimports
sortimports
strconv❌ log 3/4imports
stringsimports
sync❌ error❌ error❌ errorimports
sync/atomic❌ error❌ error❌ errorimports
syscall❌ log 2/4❌ log 2/4❌ log 2/4imports
syscall/js❌ error❌ error❌ errorimports
testing/fstest❌ log 2/3❌ log 2/3❌ log 2/3imports
testing/iotest❌ log 12/15❌ log 12/15❌ log 12/15imports
testing/quick❌ error❌ error❌ errorimports
text/scannerimports
text/tabwriter❌ log 2/3❌ log 2/3❌ log 2/3imports
text/template❌ error❌ error❌ errorimports
time❌ error❌ error❌ errorimports
unicodeimports
unicode/utf16imports
unicode/utf8imports
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