Sample code using TARDIS Go, both command line and animated graphical.
For help or general discussions about this repository please go to the Google Group.
Go by example : adapted command line examples
- hello world
- variadic functions
- recursion
- closures
- methods
- interfaces
- channel synchronization
- Non-Blocking Channel Operations
- range over channel
- stateful goroutines (uses "sync/atomic" package)
- sorting by functions (uses "sort" package)
- collection functions (uses "strings" package)
- string functions (uses "strings" package; strings.split function not yet working correctly for Flash target)
- number parsing (uses "strconv" package, not working for Flash target)
- base64 encoding (uses "encoding/base64" package, not working for PHP target)
gohaxelib : command line samples showing Haxe called from Go
The gohaxelib methodology is still very experimental and incomplete, as are these examples. To run the gohaxlib examples, you will first need to:
go get "github.com/tardisgo/gohaxelib/_haxeapi"
- printdatetime - Print current Haxe date and time using the Haxe "target".Lib.println() API if one exists
- geturl Print tardisgo web site LICENSE in the simplest way possible (this particular formulation does not work for JavaScript, C# or Flash)
OpenFL : animated graphical multi-platform samples showing Go called from Haxe
You can see these examples working live at http://tardisgo.github.io/
- gohandlingmouseevents (adapted from the OpenFL example)
- concurrentgophers (inspired by slide 21 of "Concurrency is not Parallelism (it's better)" a talk by Rob Pike)
- 8concurrentgophers (as above, but with 8 gophers rather than 2, for FOSDEM14 presentation; modified 19-Mar-2014 to use new openfl-html5 back-end)
To compile and run them you will also need to follow the instructions to install OpenFL here. From the "Source" directory, check there is a "tardis" sub-directory and run the tardisgo command as normal e.g. "tardisgo mouse.go". Then follow the normal OpenFL/Lime development process from the directory above, try: "lime test html5". Or use the tgolime.sh script described below.
For OSX and Ubuntu users, here are some scripts that might help, they are written for HAXE 3.1.1. NOTE: The tardisgo -testall flag (e.g. "tardisgo -testall mycode.go") provides the same functionality as tgoall.sh/tgoallu.sh below, but runs all the jobs concurrently and so is faster:
- tgo.sh : transpile all the code in the current directory and run haxe on the result using the user-provided haxe flags
- tgoall.sh : transpile all the code in the current directory for all haxe targets and test each of them (requires all the haxe target languages to be installed, with any required haxelibs, tested on OSX)
- tgoallu.sh : Ubuntu version of tgoall.sh
- tgolime.sh : wrapper for the OpenFL "lime" command, to transpile the Go first
- mandlebrot
- fannkuch
A snapshot of TARDIS Go's poor relative performance as at January 2014 can be found in the graph here. But please note that both llgo and GopherJS had elements of their core Go implementations missing when these tests were run.
Improving the speed of TARDIS Go will be a focus of future development, with results reported at intervals.
A directory for non-passing tests that are a work-in-progress and are referenced by tardisgo issues.