Interview preparation
Go interview questions
28 lessons in this track
All questions and short answers on one page →
Foundation — the basics
- 1Structs and methods in Go: a value that is copied whole55 MIN
- 2Pointers in Go: everything is passed by value, even a pointerClearer after: Structs and methods55 MIN
- 3Reflection in Go: reflect.Type, reflect.Value and the settability ruleClearer after: Structs and methods · Pointers50 MIN
- 4io.Reader and io.WriterA contract of two methodsClearer after: Structs and methods50 MIN
- 5Go toolingBuild, vet, fmt and what they check45 MIN
- 6Functions and closures in Go: what gets captured and whenClearer after: Pointers55 MIN
- 7Packages and layoutPackages in Go: visibility, init and project layoutClearer after: Structs and methods · Go tooling50 MIN
- 8Modules and dependenciesGo modules and dependencies: go.mod, go.sum and minimal version selectionClearer after: Packages and layout60 MIN
- 9JSON and tagsJSON in Go: tags, omitempty and what encoding/json does silentlyClearer after: Structs and methods · Reflection65 MIN
- 10Concurrency patterns in Go: worker pool, pipeline, fan-inClearer after: Functions and closures65 MIN
Then — by frequency in question listings
- 11Slices in Go: a window onto somebody else's array, two paths through append, and a growth rule everyone remembers wrong35 MIN
- 12Maps in Go: a group of eight, the 7/8 threshold, and a miss that costs more than a hit40 MIN
- 13Strings and runesStrings, runes and bytes: why len does not count characters, and a substring holds megabytesClearer after: Slices30 MIN
- 14Interfaces in Go: two words, a nil that is not nil, and a call four times dearer35 MIN
- 15Method receivers in Go: the copy you cannot see, and the "pointer is faster" that is wrongClearer after: Interfaces25 MIN
- 16EmbeddingStruct embedding in Go: composition that gets mistaken for inheritanceClearer after: Method receivers30 MIN
- 17Errors in Go: the one letter that breaks the chain, and the type assertion that will stop workingClearer after: Interfaces25 MIN
- 18defer, panic, recoverdefer, panic and recover in Go: three moments instead of one, and a recover that silently does nothingClearer after: Errors35 MIN
- 19Context in Go: cancellation only downwards, a cancel that is not about cancelling, and a Value that grows dearer with depthCome back after: Channels · The scheduler30 MIN
- 20The schedulerGoroutines and the Go scheduler: two thousand bytes, preemption, and a GOMAXPROCS that limits the wrong thing30 MIN
- 21Channels in Go: a value that bypasses the buffer, a select with no priorities, and a price paid in parkingClearer after: The scheduler25 MIN
- 22sync and atomic in Go: two pieces of advice that fall apart under measurementClearer after: Channels · The scheduler30 MIN
- 23Data races in Go: what breaks, what -race sees and what it does notClearer after: sync and atomic30 MIN
- 24Stack and heapStack, heap and escape analysis: why a pointer means nothing yetClearer after: Slices · Interfaces30 MIN
- 25Garbage collectorThe garbage collector: why pauses do not grow with the heap, and GOGC speeds up nothingClearer after: Stack and heap30 MIN
- 26Profiling in Go: what pprof shows and what it does not show by defaultClearer after: Garbage collector30 MIN
- 27Testing in Go: what t.Run, t.Parallel and a benchmark really doClearer after: Data races35 MIN
- 28HTTP serverThe HTTP server in Go: what net/http does by itself and what it does not do until askedClearer after: Context30 MIN
Final check: the Go track
One question per lesson in the track. Not a recap, but the places where the mechanism gives an answer nobody expects: a shared array after append, the iteration order of a map, select without priorities, and a nil that is not nil.
Final check1 / 28
type Team struct{ Name string; Members []string }. a := Team{Name: `core`, Members: []string{`ann`}}; b := a; b.Name = `infra`; b.Members[0] = `bob`. What does fmt.Println(a.Name, a.Members[0]) print?