go2hx

samples

docs

api

github


Open source Haxe compiler

Import Go libraries in your Haxe projects

Getting started



Standard Library compatibility

last updated: 2025-05-23 04:04:45

commit: 10d4677

modulehlinterpjs
bufio❌runtime
76/79
bytes
compress/bzip2❌runtime
3/4
❌runtime
3/4
❌runtime
3/4
container/heap
container/list
container/ring
context❌buildtime❌buildtime❌buildtime
crypto
crypto/aes❌runtime
10/13
❌runtime
10/13
❌runtime
10/13
crypto/cipher❌runtime
3/14
❌runtime
3/14
❌runtime
3/14
crypto/des❌runtime
2/18
❌runtime
6/18
❌runtime
2/18
crypto/md5❌runtime
4/6
❌runtime
4/6
❌runtime
4/6
crypto/rand❌buildtime❌buildtime❌runtime
5/10
crypto/sha1❌runtime
5/7
❌runtime
5/7
❌runtime
5/7
crypto/sha256❌runtime
7/9
❌runtime
7/9
❌runtime
7/9
crypto/sha512❌runtime
6/8
❌runtime
6/8
❌runtime
6/8
encoding❌buildtime❌buildtime❌buildtime
encoding/ascii85
encoding/base32❌runtime
22/23
❌runtime
21/23
encoding/base64❌runtime
16/17
encoding/base64❌runtime
16/17
encoding/binary❌runtime
14/30
❌runtime
15/30
❌runtime
14/30
encoding/csv
encoding/gob❌buildtime❌buildtime❌buildtime
encoding/hex
encoding/json❌runtime
2/24
❌runtime
2/24
❌runtime
13/84
errors❌runtime
8/9
❌runtime
8/9
❌runtime
8/9
flag❌buildtime❌runtime
16/24
❌buildtime
fmt❌runtime
25/44
❌runtime
28/51
❌runtime
28/51
go/ast❌buildtime❌buildtime❌buildtime
go/constant❌buildtime❌buildtime❌buildtime
go/format❌buildtime❌buildtime❌buildtime
go/importer❌buildtime❌buildtime❌buildtime
go/printer❌buildtime❌buildtime❌buildtime
go/scanner❌buildtime❌buildtime❌buildtime
go/token❌buildtime❌buildtime❌buildtime
go/token❌buildtime❌buildtime❌buildtime
go/types❌buildtime❌buildtime❌buildtime
hash
hash/adler32
hash/adler32
hash/crc32❌runtime
7/8
❌runtime
7/8
❌runtime
7/8
hash/crc64
hash/fnv
hash/html❌buildtime❌buildtime❌buildtime
image❌buildtime❌buildtime❌buildtime
image/color
image/draw❌buildtime❌buildtime❌buildtime
index/suffixarray❌buildtime❌buildtime❌buildtime
io❌runtime
46/53
io/fs❌runtime
12/14
❌runtime
12/14
❌runtime
12/14
log❌runtime
5/9
❌runtime
5/9
❌runtime
5/9
math❌runtime
75/76
math/big❌buildtime❌buildtime❌buildtime
math/bits❌runtime
25/26
math/cmplx❌runtime
15/23
❌runtime
15/24
❌buildtime
math/rand❌runtime
11/17
❌runtime
12/17
❌runtime
10/17
os❌runtime
28/127
❌runtime
28/127
❌runtime
30/127
os/exec❌buildtime❌buildtime❌buildtime
path
path/filepath❌runtime
15/28
❌runtime
15/28
❌runtime
17/39
reflect❌buildtime❌buildtime❌buildtime
regexp❌buildtime❌buildtime❌buildtime
regexp/syntax
runtime❌buildtime❌buildtime❌buildtime
runtime/debug❌buildtime❌buildtime❌buildtime
slices❌runtime
2/43
❌runtime
2/43
❌runtime
2/43
sort
strconv❌runtime
54/56
strings
sync❌buildtime❌buildtime❌buildtime
sync/atomic❌buildtime❌buildtime❌buildtime
syscall❌runtime
2/4
❌runtime
2/4
❌runtime
2/4
syscall/js❌buildtime❌buildtime❌buildtime
testing/fstest❌runtime
3/5
❌runtime
3/5
❌runtime
3/5
testing/iotest❌runtime
12/15
❌runtime
12/15
❌runtime
12/15
testing/quick❌buildtime❌buildtime❌buildtime
text/scanner
text/tabwriter❌runtime
2/3
❌runtime
2/3
❌runtime
2/3
text/template❌buildtime❌buildtime❌buildtime
text/template❌buildtime❌buildtime❌buildtime
time❌buildtime❌buildtime❌buildtime
unicode
unicode/utf16
unicode/utf8
FAQ

Can library X be compiled?

Check online via:

Manual check:

You would need to check what imports and language features the library is using.

If it uses unsafe or generics, the library will not work.

If it uses networking or unsupported stdlibs it also will not work.

Does the compiler support Go as a Haxe target?

No and it's not within the scope of the project, however happy to knowledge transfer and support any Go target for Haxe.

Can high performance be achieved with the compiled code?

Yes! There is no inherent systemic issue with the compiled code having comparable speeds with normal Haxe code. The compiler does AST to AST translation so it is at the same level of abstraction for the Haxe compiler to be able to optimize the code in the same way as if it was handwritten.

The layer functions or interop files for the go2hx styled Haxe code to normal Haxe code does certantily have a performance penality, however for basics types it can be 0 because of Haxe's 0 cost abstractions, and in the case of structures or other cases where this is an allocation, it is possible to use the internal go2hx datatypes to not pay the penality (at the cost of ease of use).

This area is truthfully not very explored because of the priority of getting the compiler correct. If it is a painpoint for your usecase, we would love to hear more about it and improve it.

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

Because externs prevent multi target usage of the compiler and they need to be maintained and written. This project is meant to provide 100s of thousands of high quality tested Go libraries with no maintance and no need to write an abstraction level.

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?

The compiler uses Haxe stdlib implmentations when interacting with the fileysytem and primitive math operations. In other cases the internals are transpiled into Haxe code and uses those.

Have issues and/or want to contribute?

github discord