Tutorial: your first Golo program in Turbo Golo
By the end of this tutorial you will have written, run and broken a small Golo program without leaving the editor — and seen the editor tell you where the mistake was.
No prior knowledge of Turbo Golo is needed. You need Go 1.26 or later to build the editor, and the golo interpreter to run the program.
Prerequisites
Check Go:
go version
You should see something like:
go version go1.26.5 linux/arm64
Check the interpreter:
golo --version
v0.1.1 | dev.20260802.🤓
If that command is not found, install it first — a download or one script does it.
Step 1 — Install the editor
git clone https://rickub.com/turbo-editors/turbo-golo.git
cd turbo-golo
make install
The installer builds, installs, and then checks what it installed. The last lines are:
==> Checking the language server
✓ golo at /usr/local/bin/golo — completion comes from `golo lsp`
==> Ready
We now have a turbo-golo command.
Step 2 — Make a directory
mkdir /tmp/hello
cd /tmp/hello
That is the whole of making a Golo project: Golo has no manifest, a script is a file, and a program is a directory of them. The directory you start the editor in is where the Golo menu's commands will run, so start it here.
Step 3 — Open a file that does not exist yet
turbo-golo hello.golo
The screen fills. Along the top:
File Edit Search Run Code Options Window Snippets Golo Help
Ten menus, and the ninth is named after the language. In the middle, an empty window titled hello.golo. Along the bottom, at the right-hand end, you should see:
1:1 LSP: ready
LSP: ready means golo lsp — the interpreter, in language-server mode — started in this directory. We will use it in Step 8.
Step 4 — Write the program
Type this in. Type it exactly; we will look at the colours next.
module hello.World
# Greet someone several times
struct Greeting = { name, times }
function greet = |g| {
foreach i in range(1, g: times() + 1) {
println("Hello, " + g: name() + "! (" + i + ")")
}
}
function main = |args| {
greet(Greeting("Golo", 3))
}
If a completion list drops down while you type — a . asks for one by itself, and hello. is one — keep typing or press Escape; Enter would accept the first entry.
Press F2 to save. The status bar says Saved hello.golo.
Step 5 — Read the colours
Look at what you have typed. In the default turbo-classic theme:
| What | Colour |
|---|---|
module, struct, function, foreach, in |
bright white, bold — keywords |
hello.World, Greeting |
bright cyan — a module path, and a type |
greet, where it is declared and where it is called |
bright yellow, bold — functions |
range, println |
bright cyan, bold — functions the interpreter provides |
name, times, g, i, args |
bright yellow — ordinary names |
"Hello, ", "! (", ")", "Golo" |
green — strings |
1, 3 |
magenta — numbers |
# Greet someone several times |
grey — a comment |
|, :, +, = |
white — operators |
Two of those rows are worth a second look.
Greeting is cyan and greet is yellow, and nothing in the editor was told which of them is a type. Golo's convention decides it: structs, unions and their variants are the names people capitalise, so a capital letter is coloured as a type.
greet is yellow where it is declared, after function, although no parenthesis follows it there. The name after function is a function by position — and that is a deliberate rule.
Step 6 — Give the project its tools
Press F10 to open the menu bar, then → eight times to reach Golo — past Edit, Search, Run, Code, Options, Window and Snippets. Faster: press Alt-G.
The menu holds two items, and only one of them is available:
┌───────────────────┐
│ Create tools file │
│ Open tools file │ ← greyed out; there is no file to open yet
└───────────────────┘
Choose Create tools file.
A second window opens on the file that was just written, .turbo-golo/tools.toml. Read it if you like — it explains every key it uses — then press Ctrl-W to close it.
Look at the menu bar: a Tools menu has appeared between Golo and Help. The starter file's last entry names a menu of its own, and that one line is the whole mechanism.
Open the Golo menu again. It now holds eight commands, and the two items have swapped: Create tools file is greyed out, and Open tools file is the one you can choose.
Step 7 — Run it
Press Alt-G and choose Run. A box asks for a value before the command runs, because Golo has no manifest that says which file is the program:
┌──────────────── Run ────────────────┐
│ script, e.g. main.golo │
│ [ ] │
└─────────────────────────────────────┘
Type hello.golo and press Enter. A terminal window opens and the program runs in it:
Hello, Golo! (1)
Hello, Golo! (2)
Hello, Golo! (3)
A terminal rather than a dialog, because a program that reads the keyboard has to be answerable. The program has finished, so the window has stopped behaving like a terminal and every key reaches the editor again: press Ctrl-W to close it.
Step 8 — Break it, and see where
Go to the end of the file, after the last }, and add a comment the way another language would write it:
// run it
Press F2 to save.
Within a second, two things happen. A red × appears in the gutter, just left of that line's number. And the status bar reads:
⚠ GoloScript has no '//' line comments. GoloScript comments are '#' for a single line (e.g. …
Nothing asked for that. golo lsp publishes it by itself whenever it re-reads the file — a syntax error would have earned the same mark, and this one is a lint the server adds because it is the mistake everybody arriving from another language makes first.
Change the // to # and save again; both the mark and the message go away.
Step 9 — Change the theme
F10, then → five times to reach Options — past Edit, Search, Run and Code. Choose Theme….
A list opens on the theme you are in. Press ↓ to cobalt and Enter. The whole screen changes, keeping the same shape.
Press Alt-X to leave. The editor asks about unsaved files first, if there are any.
What now?
You have written a Golo program in the editor, run it, broken it, and seen the editor say where. To go further:
- To do specific things → the how-to guides
- To see exactly what is coloured and how → languages coloured
- To understand why the editor is built this way → the explanation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|