Of course, we need to run this incredibly complex application.
Golo comes with a golo
script found in the distribution bin/
folder. It provides several
commands, notably:
version
to query the Golo version, and
compile
to compile some Golo code to JVM classes, and
run
to execute some already compiled Golo code, and
golo
to directly execute Golo code from source files, and
diagnose
to print compiler internal diagnosis information, and
doc
to generate module(s) documentation, and
new
to generate new project(s).
The complete commands usage instructions can be listed by running golo --help
.
A command usage instructions can be listed by running golo --usage ${command}
.
The golo
script comes with JVM tuning settings that may not be appropriate to your
environment. We also provide a vanilla-golo
script with no tuning. You may use the $JAVA_OPTS
environment variable to provide custom JVM tuning to vanilla-golo
.
Provided that golo
is available from your current $PATH
, you may run the program above as
follows:
$ golo golo --files samples/helloworld.golo Hello world! $ golo golo --files samples/ --module hello.World Hello world! $
golo golo
takes several Golo source files (*.golo and directories) as input.
It expects the last one to have a main
function to call (or use
--module
to define the golo module with the main
function).
The Golo code is compiled on the fly and executed straight into a JVM.
You may also pass arguments to the main
function by appending --args
on the command line invocation. Suppose that we have a module EchoArgs
as follows:
module EchoArgs function main = |args| { foreach arg in args { println("-> " + arg) } }
We may invoke it as follows:
$ golo golo --files samples/echo-args.golo --args plop da plop -> plop -> da -> plop $
Note that args
is expected to be an array.
Finally, the --classpath
flag allows to specify a list of classpath elements, which can be either
directories or .jar
files. See the golo help
command for details on the various Golo commands.