Effective Go (VS Code)
A Visual Studio Code / Cursor extension for learning Go with interactive exercises based on Effective Go.
The sidebar Course tree lists all 73 exercises across eight modules. Quizzes grade in the extension host; coding labs edit real .go files and run go test. Progress and progressive hints are stored in VS Code globalState.
Install
Extension ID: 12yanogden.effective-go
From the Marketplace (once published)
- In VS Code / Cursor: Extensions → search Effective Go, or open Marketplace: 12yanogden.effective-go.
- Click Install.
Or from the command line:
code --install-extension 12yanogden.effective-go
From a VSIX
Build locally (or download a release .vsix), then:
npm run package:vsix # writes effective-go-0.1.0.vsix at the repo root
code --install-extension effective-go-0.1.0.vsix
In the UI: Extensions → ⋯ → Install from VSIX… → pick effective-go-0.1.0.vsix.
Prerequisites
| Requirement |
Notes |
| VS Code or Cursor 1.85+ |
Extension Development Host via F5 works in both |
| Go toolchain |
go on your PATH, or set effectiveGo.goPath |
| Go extension (optional) |
golang.go for richer editing; not required to grade labs |
| Node.js 20+ |
Only needed to build / develop the extension |
| Workspace folder |
Required for coding exercises (starter files land under .effective-go/) |
Install Go from https://go.dev/dl/ if needed, then confirm:
go version
F5 / development flow
npm install
npm run compile
- Open this repository as a folder in VS Code or Cursor.
- Press F5 (launch config Run Extension). A new Extension Development Host window opens.
- In the host window, open any workspace folder (your own project or an empty folder) — coding labs need somewhere to write
.effective-go/<id>/.
- Click the Effective Go icon in the Activity Bar, or run Effective Go: Open Course.
Validate content against the schema:
npm run validate:exercises
Automated Extension Host smoke (activate + catalog + quiz grade):
npm run test:integration
(npm test runs unit tests then this smoke suite. First integration run downloads a VS Code build into .vscode-test/.)
Manual F5 / UI checklist: docs/qa-checklist.md.
npm run package:vsix
How to use the course
- Browse — expand modules in the Course tree. Completed exercises show a checkmark.
- Open — click an exercise. Quizzes render in the webview; coding exercises copy starter files into
.effective-go/<exercise-id>/ and open the edit file.
- Hint — Show Hint reveals progressive hints one at a time (already unlocked hints stay visible).
- Check — Check Answer grades the quiz or runs
go test on your workspace copy (tests are overlaid from the packaged exercise each run).
- Run in Terminal (coding) — opens an integrated terminal in
.effective-go/<id>/ and runs go test . so you can iterate without Check Answer.
- Reset — restores quiz answers / recopies starter files and clears completion for that exercise.
- Next — Next Exercise (webview button or command) advances to the next catalog entry.
Commands
| Command |
Action |
Effective Go: Open Course |
Focus the Course view and open your current / next incomplete exercise |
Effective Go: Open Exercise |
Open a specific exercise (also used by the tree) |
Effective Go: Check Answer |
Grade quiz or run tests |
Effective Go: Show Hint |
Reveal the next progressive hint |
Effective Go: Reset Exercise |
Clear progress and restore starter files |
Effective Go: Run in Terminal |
Coding only — go test . in the scaffold dir |
Effective Go: Next Exercise |
Advance to the next exercise in catalog order |
Empty states
- No workspace folder — coding exercises show a notice and prompt you to open a folder; Check Answer will not run until a folder is open and the exercise has been (re)opened.
- Go missing — a notice explains how to install Go or set
effectiveGo.goPath; Check Answer fails with the same guidance.
Settings
| Setting |
Default |
Purpose |
effectiveGo.goPath |
go |
Path to the Go binary |
effectiveGo.testTimeoutMs |
30000 |
Default go test timeout (ms); per-exercise timeoutSeconds wins |
Exercise contract
Authoritative schema: docs/exercise-contract.md.
exercises/
catalog.json # source of truth for the Course tree (73 entries)
NN-module/
eg-NN-slug/
exercise.json
prompt.md
starter/ # coding
tests/ # coding
solution/ # optional; excluded from VSIX via .vscodeignore
Webview messages
webview → host: { type: 'check' | 'hint' | 'reset' | 'ready' | 'next', ... }
host → webview: { type: 'ready' | 'result' | 'hint', ... }
Quiz check sends { answers: number[] }. result uses { ok, message, details? }.
Project layout
src/
extension.ts # activate + commands (+ EffectiveGoApi for smoke)
course/catalog.ts # catalog.json + manifests
course/progress.ts # globalState
course/types.ts # contract types
exercise/panel.ts # WebviewPanel + postMessage
exercise/scaffold.ts # copy starter into workspace
exercise/grader.ts # go test / quiz check
views/courseTree.ts # TreeDataProvider
test/extension.test.ts # Extension Host smoke (@vscode/test-cli)
media/ # webview CSS/JS (CSP nonce)
exercises/ # course content (modules 01–08)
docs/exercise-contract.md
scripts/validate-exercises.mjs