Stage 1 · Code
Getting Started
Editor Setup
Configure a beginner-friendly Go editor with formatting, diagnostics, and a terminal in one place.
Choose an Editor
You can write Go in any text editor, but a programming editor makes learning easier. It highlights syntax, formats code, shows errors, jumps to definitions, and opens a terminal beside your files.
This course works well with Visual Studio Code because it is free, cross-platform, and has an excellent Go extension. JetBrains GoLand is also a strong paid alternative with many Go features built in.
| Editor | Strength | Good fit for |
|---|---|---|
| VS Code | Free, lightweight, excellent extensions | Most beginners |
| GoLand | Deep Go-specific IDE features | Developers who want a full IDE |
| Plain text editor | Simple and universal | Small edits, not ideal for learning feedback |
VS Code and the Go Extension
Install VS Code from https://code.visualstudio.com/. Then open the Extensions view, search for Go, and install the official extension published by the Go team at Google.
The extension uses gopls, the Go language server. A language server understands your code and powers completion, hover help, rename, diagnostics, and jump-to-definition.
mkdir hello-editor
cd hello-editor
go mod init example.com/hello-editor
code .The code . command opens the current folder in VS Code if the command-line launcher is installed.
When VS Code asks to install or update Go tools, accept it. Those tools power editor features and are separate from the Go compiler itself.
Format on Save
Format-on-save means your editor runs the Go formatter whenever you save a file. This removes a whole category of beginner frustration: spacing and indentation become automatic.
{
"editor.formatOnSave": true,
"[go]": {
"editor.defaultFormatter": "golang.go",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
}
},
"go.useLanguageServer": true,
"gopls": {
"ui.semanticTokens": true,
"analyses": {
"unusedparams": true,
"shadow": true
},
"staticcheck": true
}
}Open Command Palette → Preferences: Open User Settings (JSON), then add these settings carefully.
Diagnostics and Terminal
Diagnostics are warnings and errors shown in the editor, often with red or yellow underlines. They can catch missing imports, unused variables, and syntax mistakes before you run the program.
Use the integrated terminal for course commands: View → Terminal in VS Code. Running go run ., go test ./..., and go fmt ./... from inside the editor keeps your code and feedback together.
If the editor looks confused, run commands in the terminal. go test, go build, and go env tell you what the actual Go toolchain sees.
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.