Loading…
40+ curated questions with the same answer shape every time: quick recap, deep dive, pitfalls, and follow-ups. Coverage includes struct definition, struct literal and fields, value vs pointer receivers, method sets, and more.
Suggested path
Topics follow a teaching order. Each answer ends with a clear Next question control so you can move forward without hunting the list.
Structs and interfaces are Go's answer to classes and inheritance — and the interview question 'how does Go do OOP?' is one every Go fresher faces. This module covers struct definition and initialisation (named fields, positional literals, the zero-value struct), value receivers vs pointer receivers (when a method should take *T vs T, the rule of thumb: mutating methods take a pointer receiver, read-only methods can take either, but be consistent on a type), the method set rules (value T includes value-receiver methods; *T includes both), interfaces in Go (defining an interface with one or more method signatures), implicit satisfaction (a type satisfies an interface by having the right methods — no 'implements' keyword needed), and struct embedding as Go's composition mechanism. Every answer addresses the comparison to Java/Python classes that interviewers expect you to articulate: 'Go doesn't have inheritance — what does it have instead and why is that a good thing?'
Full catalog
Topics are ordered for learning. Within each topic, rows are numbered 1–40 globally so you always know where you are. Collapse topics if you want a lighter view — use Expand all when you need the full list again.
Numbers 1–40 follow the order we recommend — click any row to open the full answer, or use the sticky Next link at the bottom of each page to go Q1 → Q40.