Warning
experimental version, not able to compile most Go code correctly.
- A few std libs (compatibility).
- No support for Cgo and Go assembly
- 95% of the normal language features
haxelib git go2hx https://github.com/go2hx/go2hx
Run compiler on a file:
haxelib run go2hx ./main.go
Run compiler on a library:
Caution
Almost all libs will not work yet, because of missing stdlib support.
haxelib run go2hx golang.org/x/example/stringutil
A spiritual successor to Tardisgo written by Elliott Stoneham, A maintainer, mentor, and code contribuitor of this project. Elliott's wise counsel, solid engineering design, and effective programming is the core of this project and go2hx would not exist without him.
Tip
Commands in this documentation such as: haxe
and haxelib
may have npx
as a prefix, that's because in those cases the command is using the local npm package lix to run Haxe, this is optional and if you would like to use non lix commands that's supported as well.
git clone https://github.com/go2hx/go2hx
npm i lix
npx lix download
cd go2hx
haxelib dev go2hx .
Now you can run the compiler, for example:
npx haxelib run go2hx ./main.go
Note
Look at Run.hx to see how the building occurs.
After you have setup from source and ran the compiler at least once you should be able to use the dev tools, here is the list and how they work.
-
npx haxe rnd.hxml
: rnd stands for research and development, it's a quirky name for a test bed that runs./rnd/main.go
use it for rapid testing of go snippets and comparison with go output. -
npx haxe stdgo.hxml
: (requires nodejs) go's standard library generator, all std pkgs compiled are added into./stdgo/*
for generating specific std go libs use the-D libs
flag. For example to compileunicode/utf8
andstrings
run:npx haxe stdgo.hxml -D libs=unicode/utf8,strings
-
npx tests.hxml && hl tests.hl [suite]
: (requires hashlink) A multi suite test runner with a built in regression tracker, used primarily by github actions to test for progression and regression of every commit to the project. [suite] can be any of the following added as an argument: unit, stdgo, yaegi, gobyexample, go . For examplenpx tests.hxml && hl tests.hl stdgo
. Note&&
separates out 2 arguments forunix
for windows you may need to use||
-
npx haxe stdgo/[std].hxml --[target]
: A series of hxml files created by running the stdgo test suite. Every stdlib listed in./tests.json
has an hxml file created at./stdgo
root folder. For example to rununicode/utf16
with theinterp
target :npx haxe stdgo/unicode_utf16.hxml --interp