Getting Started
Set up GoLearn and start your first exercise.
Prerequisites
Install Go 1.22 or later:
- macOS:
brew install go
- Linux:
sudo apt install golang-go
- Windows: Download from golang.org
go version
Installation
go install github.com/zhravan/golearn/cmd/golearn@latest
golearn --help
First Exercise
- List exercises:
golearn list
- Start first exercise:
golearn verify 01_hello
- Get hints:
golearn hint 01_hello
- Edit the template file and implement the solution
- Verify your solution:
golearn verify 01_hello
Getting Started as a Learner (CLI only)
- List available exercises:
golearn list
- Initialize local templates (optional):
golearn init
- Try an exercise (expect failure until you implement it):
golearn verify 01_hello
- Read a hint:
golearn hint 01_hello
- Edit the template file for the exercise, then re-run
verify
- See your overall progress:
golearn progress
- Optionally view the reference solution:
golearn solution 01_hello
- Reset an exercise to its starter state:
golearn reset 01_hello
Getting Started as a Contributor
- Read the contribution guide: Contributing
- Fork and clone the repo, create a feature branch
- Build the CLI locally:
go build -o bin/golearn ./cmd/golearn && chmod +x bin/golearn
- Develop your exercise/update under
internal/exercises
- Verify templates (incomplete templates should fail):
golearn verify
- Verify specific exercise with solution (should pass):
golearn verify 01_hello --solution
- Run auxiliary checks locally:
go fmt ./...
andgo vet ./...
- Open a Pull Request
Commands
golearn list
- List all exercisesgolearn verify [exercise]
- Verify an exercisegolearn hint [exercise]
- Get hintsgolearn progress
- Show progressgolearn solution [exercise]
- View solution
CLI Commands
Command | Description | Example |
---|---|---|
golearn --help |
Show help and available commands | golearn --help |
golearn list |
List all available exercises | golearn list |
golearn verify [exercise] |
Verify all templates or a specific exercise |
golearn verify golearn verify 01_hello |
golearn verify [exercise] --solution |
Verify using the reference solution (should pass) | golearn verify 01_hello --solution |
golearn hint [exercise] |
Show hints for a specific exercise | golearn hint 01_hello |
golearn solution [exercise] |
View the reference solution (may prompt for confirmation) | golearn solution 01_hello |
golearn progress |
Display your overall progress | golearn progress |
golearn reset [exercise] |
Reset an exercise to its starter template | golearn reset 01_hello |
golearn init |
Initialize local exercise templates | golearn init |
golearn publish [--dry-run] |
Run publish routine (use --dry-run to preview) |
golearn publish --dry-run |
golearn watch |
Watch files and re-verify on changes | golearn watch |
Global Flags
Flag | Description | Example |
---|---|---|
--no-color |
Disable colored output | golearn --no-color list |
--theme=<name> |
Set output theme (high-contrast , monochrome ) |
golearn --theme=high-contrast list |