Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation

Goblin is installed through the Go toolchain. Install Go 1.20 or later, then verify that it is available:

$ go version

Install with go install

$ go install github.com/aisk/goblin@latest

This downloads, builds, and installs goblin into $GOBIN, normally $HOME/go/bin when GOBIN is unset. Ensure that directory is on your PATH.

For a typical Unix shell, add the following line to your shell profile if goblin is not found after installation:

export PATH="$PATH:$(go env GOPATH)/bin"

Verify the installation

$ goblin --help

If help text is printed, the installation is ready to use.

The CLI provides three subcommands:

CommandPurpose
goblin run file.goblin [args...]Interpret a source file (trailing args become os.argv(); put the file before any flags)
goblin build-exe file.goblinBuild a native executable
goblin replStart an interactive session

For goblin run, CLI help is goblin run -h or goblin help run. Script flags such as -v must come after the source file.

Build from source

Alternatively, clone the repository and build it yourself:

$ git clone https://github.com/aisk/goblin.git
$ cd goblin
$ go build .

This produces a goblin executable in the current directory. While working from a clone of the repository, you can also run it directly:

$ go run . run hello.goblin

Run the project's checks before contributing a change:

$ go test ./...

To verify the complete programs mirrored in the Book, run:

$ bash docs/check-examples.sh

Updating

To update an installation made with go install, run the same command again:

$ go install github.com/aisk/goblin@latest