Day 021 — Week 3 Review + Recall¶
Month 1 · Week 3 · ⬅ Day 020 · Day 022 ➡ · Journal index
🎯 Learning Objective¶
Consolidate Week 3 (methods, interfaces, type assertions, and the full error toolkit) with closed-book recall, and capture what to carry forward.
📚 Topics¶
- Methods & value vs pointer receivers · method sets
- Interfaces & implicit satisfaction · the nil-interface trap
- Type assertions / type switches (comma-ok)
- Errors as values ·
%wwrapping · sentinel/custom errors ·errors.Is/As/Join panic/recoverand when to use them
📖 Reading / Sources¶
- Re-read my notes for [[Day 015]]–[[Day 020]]
- Effective Go — Errors
- Skimmed Go blog — Errors are values
Full write-up: Week 3 Review
📝 Notes¶
- This is a light day — the detailed synthesis, re-quiz, metrics, and next-week goals live in the week review.
- One-line summary of the week: types gain behavior via methods, interfaces decouple via implicit satisfaction, and errors are values you wrap and inspect — reserving panic for real bugs.
🏋️ Exercises / Practice¶
| Exercise | Status | Link |
|---|---|---|
All Week 3 exercises green (go test ./...) |
✅ | exercises/month-01/week-3 |
| Closed-book re-quiz (below) | ✅ | — |
🐛 Mistakes Made¶
- On recall I again said
err == ErrSentinelfirst instead oferrors.Is— flagged for spaced repetition.
❓ Open Questions¶
- Designing a clean public error API (which sentinels/types to export) — parked for the REST-API project.
🧠 Active Recall (answer without looking)¶
-
Q: Why does a
Tvalue not satisfy an interface whose method uses a pointer receiver?
A
Pointer-receiver methods belong to the method set of `*T`, not `T`. Only `*T` (and an addressable `T` via auto-`&`) satisfies the interface. -
Q: Name the three
errorshelpers and when each is used.
A
`errors.Is` (is a specific sentinel in the chain?), `errors.As` (extract a typed error from the chain), `errors.Join` (combine multiple errors so any can be matched).
🪶 Feynman Reflection¶
Week 3 was about giving types behavior and handling failure well. Methods let a type act; interfaces let unrelated types be used interchangeably without ceremony; type switches recover concrete types when needed; and errors-as-values plus wrapping make failures readable and inspectable instead of thrown.
🕳️ Knowledge Gaps¶
- Reflex for
errors.Isover==; nil-interface trap under pressure — drilling both next week.
✅ Summary¶
Week 3 consolidated: I can add methods with the right receiver, design and satisfy interfaces implicitly, assert/switch on types safely, and build/inspect error chains, reserving panic for genuine bugs.
⏭️ Next Steps / Prep for Tomorrow¶
- Start Week 4 (generics, testing depth, or stdlib deep-dive per the roadmap). See the week review for goals.
| Time spent | Difficulty | Confidence |
|---|---|---|
| 75 min | 🟦⬜⬜⬜⬜ | 🟦🟦🟦🟦⬜ |
Suggested commit: docs(journal): week 3 review and recall (day 021)