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

  1. List exercises: golearn list
  2. Start first exercise: golearn verify 01_hello
  3. Get hints: golearn hint 01_hello
  4. Edit the template file and implement the solution
  5. Verify your solution: golearn verify 01_hello

Getting Started as a Learner (CLI only)

  1. List available exercises: golearn list
  2. Initialize local templates (optional): golearn init
  3. Try an exercise (expect failure until you implement it): golearn verify 01_hello
  4. Read a hint: golearn hint 01_hello
  5. Edit the template file for the exercise, then re-run verify
  6. See your overall progress: golearn progress
  7. Optionally view the reference solution: golearn solution 01_hello
  8. Reset an exercise to its starter state: golearn reset 01_hello

Getting Started as a Contributor

  1. Read the contribution guide: Contributing
  2. Fork and clone the repo, create a feature branch
  3. Build the CLI locally: go build -o bin/golearn ./cmd/golearn && chmod +x bin/golearn
  4. Develop your exercise/update under internal/exercises
  5. Verify templates (incomplete templates should fail): golearn verify
  6. Verify specific exercise with solution (should pass): golearn verify 01_hello --solution
  7. Run auxiliary checks locally: go fmt ./... and go vet ./...
  8. Open a Pull Request

Commands

  • golearn list - List all exercises
  • golearn verify [exercise] - Verify an exercise
  • golearn hint [exercise] - Get hints
  • golearn progress - Show progress
  • golearn 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