turbo-editors/turbo-golopublic Fork 0
main
Commits
Clone
git clone https://git.rickub.com/turbo-editors/turbo-golo.git
git clone ssh://git@rickub.com/turbo-editors/turbo-golo.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

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