Files
go-learning/README.md
T

82 lines
5.5 KiB
Markdown

# Go Learning Workbook (2026 DevOps/SRE Edition)
Zeszyt ćwiczeń do nauki języka Go zaprojektowany pod **DevOps / Senior SRE / Platform Engineering w 2026 roku** — izolowane środowisko **Podman** (Zero Host Pollution), `go vet`, `staticcheck`, detektor wyścigów (`go test -race`) oraz podejście ery AI.
## Architektura pracy (Model A — podział na gałęzie)
* **`main`** — czysty szablon: nierozwiązane zadania (`exercises/`), wspólne notatki (`notes/`), `AGENTS.md`. **Nie commituj tutaj rozwiązań zadań.**
* **`attempt/<YYYY-MM>`** — gałąź robocza dla konkretnego podejścia (np. `attempt/2026-11`).
* **Powrót po czasie / start od nowa:**
```bash
git checkout main
git checkout -b attempt/2027-01
```
## Szybki start (Podman)
```bash
# 1. Zbuduj lokalny obraz z Go i staticcheck (raz)
make image
# 2. Sprawdź kompilację, go vet i staticcheck
make check
make lint
# 3. Uruchom testy wybranego rozdziału (z detektorem data race!)
make test PKG=./exercises/01-core/01-basics
make test PKG=./exercises/02-engineering-2026/01-ai-code-audit
make test PKG=./exercises/03-ecosystems/01-cli-cobra
# 4. Sformatuj kod
make fmt
```
---
## Ścieżki i checklista postępów
### Ścieżka 1: `01-core/` — Rdzeń języka (czyste `stdlib`)
- [ ] `01-basics` — [README](exercises/01-core/01-basics/README.md): zmienne, `if`, `switch`, `for`, funkcje z wieloma zwracanymi wartościami
- [ ] `02-slices-maps-strings` — [README](exercises/01-core/02-slices-maps-strings/README.md): slices, mapy, `rune` vs `byte`
- [ ] `03-structs-pointers` — [README](exercises/01-core/03-structs-pointers/README.md): struktury, wskaźniki, value vs pointer receivers
- [ ] `04-errors-handling` — [README](exercises/01-core/04-errors-handling/README.md): `errors.Is`, `errors.As`, `fmt.Errorf("%w")`
- [ ] `05-interfaces-composition` — [README](exercises/01-core/05-interfaces-composition/README.md): „OOP po go-owemu” — embedding i niejawne interfejsy
- [ ] `06-generics` — [README](exercises/01-core/06-generics/README.md): generyki w Go (`[T comparable]`, constraints)
- [ ] `07-concurrency` — [README](exercises/01-core/07-concurrency/README.md): goroutines, channels, `select`, `sync.WaitGroup`, `context`
- [ ] `08-data-structures` — [README](exercises/01-core/08-data-structures/README.md): generyczny `Stack[T]`, `Queue[T]`, thread-safe `SafeCache[K, V]`
- [ ] `09-design-patterns` — [README](exercises/01-core/09-design-patterns/README.md): Functional Options, DI przez małe interfejsy, Worker Pool
- [ ] `10-crud-repository` — [README](exercises/01-core/10-crud-repository/README.md): pełny CRUD w pamięci (`TaskStore`) z `sync.RWMutex`
- [ ] `11-algorithms` — [README](exercises/01-core/11-algorithms/README.md): wyszukiwanie binarne, two pointers (`[]rune`), sliding window, Big-O
### Ścieżka 2: `02-engineering-2026/` — Dobre praktyki i umiejętności ery AI
- [ ] `01-ai-code-audit` — [README](exercises/02-engineering-2026/01-ai-code-audit/README.md): audyt „kodu z AI” (data race, błędy, edge-case'y)
- [ ] `02-context-and-resilience` — [README](exercises/02-engineering-2026/02-context-and-resilience/README.md): `context.Context`, timeouty, retry z anulowaniem
- [ ] `03-cross-platform-os` — [README](exercises/02-engineering-2026/03-cross-platform-os/README.md): `path/filepath`, env vars, cross-kompilacja
- [ ] `04-testing-best-practices` — [README](exercises/02-engineering-2026/04-testing-best-practices/README.md): table-driven tests, `t.TempDir()`, `httptest`
- [ ] `05-testing-types-and-mutation` — [README](exercises/02-engineering-2026/05-testing-types-and-mutation/README.md): testy jednostkowe, integracyjne i mutacyjne (zabijanie mutantów)
### Ścieżka 3: `03-ecosystems/` — DevOps, SRE, Cloud Native
- [ ] `01-cli-cobra` — [README](exercises/03-ecosystems/01-cli-cobra/README.md): parsowanie argumentów CLI w `cobra`
- [ ] `02-http-api-stdlib` — [README](exercises/03-ecosystems/02-http-api-stdlib/README.md): serwer HTTP (`net/http` Go 1.22+), JSON, middleware
- [ ] `03-sre-health-and-metrics` — [README](exercises/03-ecosystems/03-sre-health-and-metrics/README.md): `/healthz`, `/readyz`, `log/slog`, metryki Prometheusa
- [ ] `04-k8s-style-reconciler` — [README](exercises/03-ecosystems/04-k8s-style-reconciler/README.md): pętla uzgadniania (*reconciliation loop* jak w operatorach K8s)
---
## Notatki i Wiedza Teoretyczna
* [Indeks notatek](notes/README.md)
* [00 — Ściągawka Go](notes/00-cheatsheet.md)
* [01 — Ekosystem Go i najważniejsze biblioteki dla SRE/DevOps (2026)](notes/01-go-ecosystem-2026.md)
* [02 — Słownik języka branżowego PL ↔ EN dla Go (Rekrutacja & Korpo)](notes/02-terminology-pl-en.md)
* [03 — Algorytmy i złożoność obliczeniowa w Go (Big-O)](notes/03-algorithms-and-complexity.md)
* [04 — Rodzaje testów w Go: jednostkowe, integracyjne, mutacyjne, fuzzing](notes/04-testing-pyramid-and-types.md)
* [05 — Efektywny debugging i czytanie błędów w Go (Panic & `-race`)](notes/05-debugging-and-reading-errors.md)
## Nauka z asystentem AI (metoda sokratejska i era 2026)
Repozytorium zawiera plik [AGENTS.md](AGENTS.md), który konfiguruje agentów AI do pracy w **3 trybach**:
* **Tryb Sokratejski (`01-core/`)** — stopniowane podpowiedzi zamiast gotowców + code review po przejściu testów.
* **Tryb Specyfikacja → Audyt (`02-engineering-2026/`)** — wyłapywanie data races (`-race`), wycieków goroutines i braków w obsłudze `context.Context`.
* **Tryb Architekta Cloud Native (`03-ecosystems/`)** — wzorce CLI (`cobra`), HTTP, observability (`slog`/Prometheus) i operatorów Kubernetes.