Project 1: CLI Task Manager with Persistence

A command-line task manager that stores tasks in JSON, supports adding, listing, completing, and deleting tasks with priorities and due dates.

Quick Reference

Attribute Value
Primary Language Go
Alternative Languages Rust, Python, TypeScript (Deno)
Difficulty Level 1: Beginner
Time Estimate Weekend
Knowledge Area CLI Development, File I/O, JSON Serialization
Tooling Cobra, Viper (optional)
Prerequisites Basic programming concepts (variables, functions, loops). No prior Go experience needed. Complete the Go Tour (tour.golang.org) first.

What You Will Build

A command-line task manager that stores tasks in JSON, supports adding, listing, completing, and deleting tasks with priorities and due dates.

Why It Matters

This project builds core skills that appear repeatedly in real-world systems and tooling.

Core Challenges

  • Structuring CLI arguments → maps to understanding os.Args and flag package
  • Serializing/deserializing JSON → maps to struct tags and encoding/json
  • File operations with error handling → maps to os package and explicit error checking
  • Organizing code into packages → maps to Go project layout conventions

Key Concepts

  • Structs and methods: “Learning Go” Ch. 7 - Jon Bodner
  • JSON encoding: “The Go Programming Language” Ch. 4.5 - Donovan & Kernighan
  • File I/O: “Learning Go” Ch. 13 - Jon Bodner
  • CLI design: “The Power of Go: Tools” by John Arundel

Real-World Outcome

$ task add "Learn Go concurrency" --priority high --due 2025-01-15
✓ Added task #1: "Learn Go concurrency" (high priority, due Jan 15)

$ task add "Read Learning Go book" --priority medium
✓ Added task #2: "Read Learning Go book" (medium priority)

$ task list
┌────┬─────────────────────────┬──────────┬─────────────┬──────────┐
│ ID │ Task                    │ Priority │ Due         │ Status   │
├────┼─────────────────────────┼──────────┼─────────────┼──────────┤
│ 1  │ Learn Go concurrency    │ HIGH     │ Jan 15 2025 │ pending  │
│ 2  │ Read Learning Go book   │ MEDIUM   │ -           │ pending  │
└────┴─────────────────────────┴──────────┴─────────────┴──────────┘

$ task complete 1
✓ Marked task #1 as complete

$ task list --status completed
┌────┬─────────────────────────┬──────────┬─────────────┬──────────┐
│ ID │ Task                    │ Priority │ Due         │ Status   │
├────┼─────────────────────────┼──────────┼─────────────┼──────────┤
│ 1  │ Learn Go concurrency    │ HIGH     │ Jan 15 2025 │ complete │
└────┴─────────────────────────┴──────────┴─────────────┴──────────┘

$ cat ~/.tasks.json
{
  "tasks": [
    {
      "id": 1,
      "title": "Learn Go concurrency",
      "priority": "high",
      "due": "2025-01-15T00:00:00Z",
      "status": "complete",
      "created": "2025-01-10T14:30:00Z"
    },
    ...
  ]
}

Implementation Guide

  1. Reproduce the simplest happy-path scenario.
  2. Build the smallest working version of the core feature.
  3. Add input validation and error handling.
  4. Add instrumentation/logging to confirm behavior.
  5. Refactor into clean modules with tests.

Milestones

  • Milestone 1: Minimal working program that runs end-to-end.
  • Milestone 2: Correct outputs for typical inputs.
  • Milestone 3: Robust handling of edge cases.
  • Milestone 4: Clean structure and documented usage.

Validation Checklist

  • Output matches the real-world outcome example
  • Handles invalid inputs safely
  • Provides clear errors and exit codes
  • Repeatable results across runs

References

  • Main guide: LEARN_GO_DEEP_DIVE.md
  • “Learning Go” by Jon Bodner