Skip to content

cloudwalksolutions/gopherlings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐹 Gopherlings

The Go equivalent of Rustlings. Fix broken code, learn by failing, and become fluent in Go syntax and idioms through hands-on exercises.


πŸ’‘ What Is Gopherlings?

Gopherlings is a terminal-based CLI tool that guides you through broken Go code and challenges you to fix it.

You don’t run a web app. You don’t follow instructions in a browser. You:

  • Edit real Go files in your own editor
  • Watch tests fail (and then pass)
  • See real compiler errors and fix them
  • Learn Go the way it’s written: from the bottom up

πŸš€ Quick Start

git clone https://github.com/cloudwalksolutions/gopherlings
cd gopherlings
go run cmd/root.go run

That’s it. Gopherlings will load your current lesson and watch your edits in real time.


🧠 Philosophy

  • Test-first mindset: Every lesson starts with failing tests
  • Hot reload: Your code is tested as you typeβ€”like a REPL, but meaningful
  • You own your flow: Use your editor, your way
  • Go idioms, not just syntax: We teach the β€œwhy” as much as the β€œwhat”
  • No scaffolding BS: Just clone and go

πŸ“ Project Structure

cmd/             CLI entrypoints (gopherlings, scaffold)
src/             Scaffolding + internal logic
templates/       Templates for new lesson generation
lessons/         Where real code lives
lesson-plan.yaml Minimal lesson manifest
proverbs.yaml    Canonical Go Proverbs

πŸ¦ͺ How It Works

Each lesson is a broken Go program in a folder:

lessons/01_variables/
β”œβ€” main.go
β”œβ€” main_test.go
β”œβ€” README.md
β””β€” .config.json

You fix the code. Gopherlings tests it. When it passes, you move on.


πŸ”₯ Key Commands

go run cmd/gopherlings/main.go run         # Run current lesson with hot reload TUI
go run cmd/gopherlings/main.go list        # Show all available lessons
go run cmd/gopherlings/main.go doctor      # Verify environment and dependencies
go run cmd/gopherlings/main.go generate    # AI-powered lesson creation

πŸ‘ Hot reload is enabled by default πŸ“… Tests are run on every save


πŸ€– AI-Powered Lesson Generation

Gopherlings now includes AI-powered lesson generation! Create custom lessons on-demand:

go run cmd/gopherlings/main.go generate

The tool will:

  1. Prompt you to describe the Go concept you want to learn
  2. Generate a complete lesson with broken code, tests, and documentation
  3. Create lesson files ready for immediate use

Example interaction:

$ go run cmd/gopherlings/main.go generate
What lesson would you like to create? Describe the Go concept or topic: interfaces and polymorphism

Generating lesson about: interfaces and polymorphism

Generated lesson:
ID: 25_interfaces_polymorphism
Title: Go Interfaces and Polymorphism
Description: Learn how to use interfaces to achieve polymorphism in Go...

Accept this lesson? (y/n): y
Lesson accepted! Writing to lessons directory...
Successfully wrote lesson files to lessons/25_interfaces_polymorphism

Powered by:

  • Google Gemini (production) for high-quality lesson generation
  • Local Ollama (development) for offline/testing scenarios
  • Smart prompting that incorporates your specific learning goals

πŸ›  Development Tools

make cov          # Run tests with coverage
make lint         # Run golangci-lint on all source code
make fmt          # Format all Go code
make run          # Run the CLI tool

🀝 Contributing

We welcome PRs! See CONTRIBUTORS.md to learn how to:

  • Add new lessons
  • Write idiomatic templates
  • Keep the spirit of Go and the Go Proverbs

🧠 Inspiration

Inspired by Rustlings, but written for people who want to think in Go.


🐾 Made by Gophers, for Gophers.

About

Gopherlings CLI for managing Go lessons

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •