Day 035 — Week 1 Review + Recall¶
Month 2 · Week 1 · ⬅ Day 034 · Day 036 ➡ · Journal index
🎯 Learning Objective¶
Consolidate the week's standard-library I/O and text material with closed-book recall, then write the formal weekly review.
📚 Topics¶
- Recap:
iointerfaces,bufio,os/files,fmtverbs,strings/strconv/bytes,strings.Builder
📖 Reading / Sources¶
📝 Notes¶
- This is a review day — the full writeup, re-quiz, action items, and metrics live in the week review file:
week-1-review.md. - One-line theme: everything in Go is a stream of bytes, and the stdlib gives small composable interfaces (
io.Reader/io.Writer) plus buffering and text tools on top. - The threads that connect the week:
io.Reader/io.Writer→ buffered bybufio→ backed byos.File→ formatted withfmt→ parsed/built withstrings/strconv/bytes/Builder.
💻 Code Examples¶
// The week in one pipeline: read a file, scan lines, build a result string.
f, _ := os.Open("data.txt") // *os.File is an io.Reader (Day 031)
defer f.Close()
sc := bufio.NewScanner(f) // buffered scanning (Day 030)
var b strings.Builder // efficient build (Day 034)
for sc.Scan() {
fmt.Fprintf(&b, "[%s]\n", sc.Text()) // fmt verbs (Day 032)
}
_ = b.String()
🏋️ Exercises / Practice¶
| Exercise | Status | Link |
|---|---|---|
| Re-run all Week 1 tests | ✅ | go test ./exercises/month-02/week-1/... |
🐛 Mistakes Made¶
- (Review day) Consolidated this week's mistakes into the weekly review's "Weaknesses" section.
❓ Open Questions¶
- Carried into the weekly review's re-quiz and next-week goals.
🧠 Active Recall (answer without looking)¶
-
Q: Name the two methods that define
io.Readerandio.Writer.
A
`Read(p []byte) (int, error)` and `Write(p []byte) (int, error)` — one method each, which is why byte streams are interchangeable. -
Q: Two stdlib gotchas from this week that silently lose data?
A
Forgetting `bufio.Writer.Flush()`, and calling `os.Exit` (which skips deferred flush/close). Both drop buffered bytes.
🪶 Feynman Reflection¶
The week clicked into one picture: a file (or socket, or string) is a byte stream behind the io.Reader/io.Writer interfaces; bufio makes streaming fast; fmt formats values into bytes; and strings/strconv/bytes/Builder parse and assemble text without wasteful copying.
🕳️ Knowledge Gaps¶
- See the weekly review for the consolidated gap list heading into Week 2 (testing & tooling).
✅ Summary¶
Week 1 of Month 2 is consolidated: I can move, buffer, format, and transform bytes/text idiomatically. Details in the weekly review.
⏭️ Next Steps / Prep for Tomorrow¶
- Read the week-1 review, then start Week 2:
testing, table-driven tests, andgotooling.
| Time spent | Difficulty | Confidence |
|---|---|---|
| 90 min | 🟦⬜⬜⬜⬜ | 🟦🟦🟦🟦⬜ |
Suggested commit: docs(journal): month 2 week 1 review and recall (day 035)