Contributing

Help improve GoLearn by contributing exercises, fixing bugs, or improving documentation.

Ways to Contribute

  • Bug Reports: Report issues on GitHub
  • New Exercises: Create exercises for Go concepts
  • Documentation: Improve guides and examples
  • Code: Fix bugs and add features

Getting Started

  1. Fork the repository on GitHub
  2. Clone your fork: git clone https://github.com/YOUR_USERNAME/golearn.git
  3. Create a branch: git checkout -b your-feature-name
  4. Make your changes and test them
  5. Commit and push: git commit -m "Your message"
  6. Create a pull request on GitHub

Creating Exercises

Each exercise needs:

  • Template file (incomplete code for learners to complete)
  • Test file (verification tests)
  • Solution file (complete implementation, base code is already in place which will run the test cases written for template to picked for solutions as well)
  • Catalog entry in catalog.yaml

Code Style

  • Follow Effective Go guidelines
  • Use gofmt to format code
  • Run go vet to check for issues
  • Write clear, descriptive commit messages

Testing

Before submitting your changes, build locally and verify exercises using the CLI:

# Build the CLI
go build -o bin/golearn ./cmd/golearn
chmod +x bin/golearn

# Verify template exercises (incomplete templates should fail)
./bin/golearn verify

# Verify a specific exercise with its solution (should pass)
./bin/golearn verify 01_hello --solution