go2hx

warning: experimental version.

Compile Go to Haxe.

Use Go libs with ease!

Get started!

Samples

Manual

Standard Library compatibility/api docs

Library compilation and test results

modulecompiletestshl
stdgo.archive.tarno_
stdgo.archive.zipno_
stdgo.bufioyes
stdgo.bytesno_
stdgo.cmpno_
stdgo.compress.bzip2yes
stdgo.compress.flateno_
stdgo.compress.gzipno_
stdgo.compress.lzwno_
stdgo.compress.zlibno_
stdgo.container.heapno_
stdgo.container.listno_
stdgo.container.ringno_
stdgo.contextno_
stdgo.cryptono_
stdgo.crypto.aesno_
stdgo.crypto.cipherno_
stdgo.crypto.desno_
stdgo.crypto.dsano_
stdgo.crypto.ecdsano_
stdgo.crypto.ed25519no_
stdgo.crypto.ellipticno_
stdgo.crypto.hmacno_
stdgo.crypto.internal.aliasno_
stdgo.crypto.internal.boringno_
stdgo.crypto.internal.randutilno_
stdgo.crypto.md5no_
stdgo.crypto.randyes
stdgo.crypto.rc4no_
stdgo.crypto.rsano_
stdgo.crypto.sha1yes
stdgo.crypto.sha256no_
stdgo.crypto.sha512no_
stdgo.crypto.subtleno_
stdgo.crypto.tlsno_
stdgo.crypto.x509no_
stdgo.crypto.x509.pkixno_
stdgo.database.sqlno_
stdgo.database.sql.driverno_
stdgo.debug.dwarfno_
stdgo.debug.elfno_
stdgo.debug.gosymno_
stdgo.debug.machono_
stdgo.debug.peno_
stdgo.debug.plan9objno_
stdgo.embedno_
stdgo.encodingno_
stdgo.encoding.ascii85no_
stdgo.encoding.asn1no_
stdgo.encoding.base32no_
stdgo.encoding.base64yes
stdgo.encoding.binaryyes
stdgo.encoding.csvno_
stdgo.encoding.gobyes
stdgo.encoding.hexyes
stdgo.encoding.jsonyes
stdgo.encoding.pemno_
stdgo.encoding.xmlno_
stdgo.errorsyes
stdgo.expvarno_
stdgo.flagno_
stdgo.fmtyes
stdgo.hashyes
stdgo.hash.adler32no_
stdgo.hash.crc32no_
stdgo.hash.crc64no_
stdgo.hash.fnvno_
stdgo.hash.maphashno_
stdgo.htmlno_
stdgo.html.templateno_
stdgo.imageyes
stdgo.image.colorno_
stdgo.image.color.paletteno_
stdgo.image.drawno_
stdgo.image.gifno_
stdgo.image.jpegno_
stdgo.image.pngno_
stdgo.index.suffixarrayno_
stdgo.internalno_
stdgo.internal.abino_
stdgo.internal.bisectno_
stdgo.internal.buildcfgno_
stdgo.internal.bytealgno_
stdgo.internal.cfgno_
stdgo.internal.cpuno_
stdgo.internal.diffno_
stdgo.internal.fmtsortyes
stdgo.internal.fuzzno_
stdgo.internal.godebugno_
stdgo.internal.godebugsno_
stdgo.internal.goversionno_
stdgo.internal.internno_
stdgo.internal.itoano_
stdgo.internal.oserrorno_
stdgo.internal.pkgbitsno_
stdgo.internal.platformno_
stdgo.internal.pollno_
stdgo.internal.raceno_
stdgo.internal.reflectno_
stdgo.internal.reflectliteno_
stdgo.internal.safefilepathno_
stdgo.internal.saferiono_
stdgo.internal.singleflightno_
stdgo.internal.syscall.unixno_
stdgo.internal.testenvno_
stdgo.internal.types.errorsno_
stdgo.internal.unsafeheaderno_
stdgo.internal.xcoffno_
stdgo.ioyes
stdgo.io.fsno_
stdgo.io.ioutilno_
stdgo.logyes
stdgo.log.internalno_
stdgo.log.syslogno_
stdgo.mathyes
stdgo.math.bigyes
stdgo.math.bitsyes
stdgo.math.cmplxyes
stdgo.math.randyes
stdgo.mimeno_
stdgo.mime.multipartno_
stdgo.mime.quotedprintableno_
stdgo.netno_
stdgo.net.httpno_
stdgo.net.http.cgino_
stdgo.net.http.cookiejarno_
stdgo.net.http.fcgino_
stdgo.net.http.httptestno_
stdgo.net.http.httptraceno_
stdgo.net.http.httputilno_
stdgo.net.http.internalno_
stdgo.net.http.internal.asciino_
stdgo.net.http.internal.testcertno_
stdgo.net.http.pprofno_
stdgo.net.mailno_
stdgo.net.netipno_
stdgo.net.rpcno_
stdgo.net.rpc.jsonrpcno_
stdgo.net.smtpno_
stdgo.net.textprotono_
stdgo.net.urlno_
stdgo.osyes
stdgo.os.execyes
stdgo.os.exec.internal.fdtestno_
stdgo.os.signalno_
stdgo.os.userno_
stdgo.pathyes
stdgo.path.filepathyes
stdgo.pluginno_
stdgo.reflectno_
stdgo.regexpyes
stdgo.regexp.syntaxyes
stdgo.runtimeno_
stdgo.runtime.cgono_
stdgo.runtime.debugno_
stdgo.runtime.metricsno_
stdgo.runtime.pprofno_
stdgo.slicesyes
stdgo.sortyes
stdgo.strconvyes
stdgo.stringsno_
stdgo.syncno_
stdgo.sync.atomic_no_
stdgo.syscallno_
stdgo.syscall.jsno_
stdgo.testingno_
stdgo.testing.fstestyes
stdgo.testing.internal.testdepsno_
stdgo.testing.iotestyes
stdgo.testing.quickyes
stdgo.text.scanneryes
stdgo.text.tabwriterno_
stdgo.text.templateyes
stdgo.text.template.parseno_
stdgo.timeyes
stdgo.time.tzdatano_
stdgo.unicodeyes
stdgo.unicode.utf16yes
stdgo.unicode.utf8yes
stdgo.unsafeno_
stdgo.archive.tarno_
stdgo.archive.zipno_
stdgo.bufiono_
stdgo.bytesno_
stdgo.cmpno_
stdgo.compress.bzip2no_
stdgo.compress.flateno_
stdgo.compress.gzipno_
stdgo.compress.lzwno_
stdgo.compress.zlibno_
stdgo.container.heapno_
stdgo.container.listno_
stdgo.container.ringno_
stdgo.contextno_
stdgo.cryptono_
stdgo.crypto.aesno_
stdgo.crypto.cipherno_
stdgo.crypto.desno_
stdgo.crypto.dsano_
stdgo.crypto.ecdsano_
stdgo.crypto.ed25519no_
stdgo.crypto.ellipticno_
stdgo.crypto.hmacno_
stdgo.crypto.internal.aliasno_
stdgo.crypto.internal.boringno_
stdgo.crypto.internal.randutilno_
stdgo.crypto.md5no_
stdgo.crypto.randno_
stdgo.crypto.rc4no_
stdgo.crypto.rsano_
stdgo.crypto.sha1no_
stdgo.crypto.sha256no_
stdgo.crypto.sha512no_
stdgo.crypto.subtleno_
stdgo.crypto.tlsno_
stdgo.crypto.x509no_
stdgo.crypto.x509.pkixno_
stdgo.database.sqlno_
stdgo.database.sql.driverno_
stdgo.debug.dwarfno_
stdgo.debug.elfno_
stdgo.debug.gosymno_
stdgo.debug.machono_
stdgo.debug.peno_
stdgo.debug.plan9objno_
stdgo.embedno_
stdgo.encodingno_
stdgo.encoding.ascii85no_
stdgo.encoding.asn1no_
stdgo.encoding.base32no_
stdgo.encoding.base64no_
stdgo.encoding.binaryno_
stdgo.encoding.csvno_
stdgo.encoding.gobno_
stdgo.encoding.hexno_
stdgo.encoding.jsonno_
stdgo.encoding.pemno_
stdgo.encoding.xmlno_
stdgo.errorsno_
stdgo.expvarno_
stdgo.flagno_
stdgo.fmtno_
stdgo.hashno_
stdgo.hash.adler32no_
stdgo.hash.crc32no_
stdgo.hash.crc64no_
stdgo.hash.fnvno_
stdgo.hash.maphashno_
stdgo.htmlno_
stdgo.html.templateno_
stdgo.imageno_
stdgo.image.colorno_
stdgo.image.color.paletteno_
stdgo.image.drawno_
stdgo.image.gifno_
stdgo.image.jpegno_
stdgo.image.pngno_
stdgo.index.suffixarrayno_
stdgo.internal.abino_
stdgo.internal.bisectno_
stdgo.internal.buildcfgno_
stdgo.internal.bytealgno_
stdgo.internal.cfgno_
stdgo.internal.cpuno_
stdgo.internal.diffno_
stdgo.internal.fmtsortno_
stdgo.internal.fuzzno_
stdgo.internal.godebugno_
stdgo.internal.godebugsno_
stdgo.internal.goversionno_
stdgo.internal.internno_
stdgo.internal.itoano_
stdgo.internal.oserrorno_
stdgo.internal.pkgbitsno_
stdgo.internal.platformno_
stdgo.internal.pollno_
stdgo.internal.raceno_
stdgo.internal.reflectliteno_
stdgo.internal.safefilepathno_
stdgo.internal.saferiono_
stdgo.internal.singleflightno_
stdgo.internal.syscall.unixno_
stdgo.internal.testenvno_
stdgo.internal.types.errorsno_
stdgo.internal.unsafeheaderno_
stdgo.internal.xcoffno_
stdgo.iono_
stdgo.io.fsno_
stdgo.io.ioutilno_
stdgo.logno_
stdgo.log.internalno_
stdgo.log.syslogno_
stdgo.mathno_
stdgo.math.bigno_
stdgo.math.bitsno_
stdgo.math.cmplxno_
stdgo.math.randno_
stdgo.mimeno_
stdgo.mime.multipartno_
stdgo.mime.quotedprintableno_
stdgo.netno_
stdgo.net.httpno_
stdgo.net.http.cgino_
stdgo.net.http.cookiejarno_
stdgo.net.http.fcgino_
stdgo.net.http.httptestno_
stdgo.net.http.httptraceno_
stdgo.net.http.httputilno_
stdgo.net.http.internalno_
stdgo.net.http.internal.asciino_
stdgo.net.http.internal.testcertno_
stdgo.net.http.pprofno_
stdgo.net.mailno_
stdgo.net.netipno_
stdgo.net.rpcno_
stdgo.net.rpc.jsonrpcno_
stdgo.net.smtpno_
stdgo.net.textprotono_
stdgo.net.urlno_
stdgo.osno_
stdgo.os.execno_
stdgo.os.exec.internal.fdtestno_
stdgo.os.signalno_
stdgo.os.userno_
stdgo.pathno_
stdgo.path.filepathno_
stdgo.pluginno_
stdgo.reflectno_
stdgo.regexpno_
stdgo.regexp.syntaxno_
stdgo.runtimeno_
stdgo.runtime.cgono_
stdgo.runtime.debugno_
stdgo.runtime.metricsno_
stdgo.runtime.pprofno_
stdgo.slicesno_
stdgo.sortno_
stdgo.strconvno_
stdgo.stringsno_
stdgo.syncno_
stdgo.sync.atomic_no_
stdgo.syscallno_
stdgo.syscall.jsno_
stdgo.testingno_
stdgo.testing.fstestno_
stdgo.testing.internal.testdepsno_
stdgo.testing.iotestno_
stdgo.testing.quickno_
stdgo.text.scannerno_
stdgo.text.tabwriterno_
stdgo.text.templateno_
stdgo.text.template.parseno_
stdgo.timeno_
stdgo.time.tzdatano_
stdgo.unicodeno_
stdgo.unicode.utf16no_
stdgo.unicode.utf8no_
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