Tengo is designed as an embedding script language for Go, but, it can also be
compiled and executed as native binary using tengo CLI tool.
To install tengo tool, run:
go get github.com/d5/tengo/cmd/tengoOr, you can download the precompiled binaries from here.
You can directly execute the Tengo source code by running tengo tool with
your Tengo source file (*.tengo).
tengo myapp.tengoOr, you can compile the code into a binary file and execute it later.
tengo -o myapp myapp.tengo # compile 'myapp.tengo' into binary file 'myapp'
tengo myapp # execute the compiled binary `myapp`Or, you can make tengo source file executable
# copy tengo executable to a dir where PATH environment variable includes
cp tengo /usr/local/bin/
# add shebang line to source file
cat > myapp.tengo << EOF
#!/usr/local/bin/tengo
fmt := import("fmt")
fmt.println("Hello World!")
EOF
# make myapp.tengo file executable
chmod +x myapp.tengo
# run your script
./myapp.tengoNote: Your source file must have .tengo extension.
If there are tengo source module files which are imported with relative import
paths, CLI has -resolve flag. Flag enables to import a module relative to
importing file. This behavior will be default at version 3.
You can run Tengo REPL
if you run tengo with no arguments.
tengo