Courses
Go Intermediate: Interfaces, Concurrency, and Services
Check Yourself
Five scenario questions on sync.WaitGroup, data races, channel closing, and select with ctx.Done().
By Jay P
Updated
5 min
GoAPIs and IntegrationsTesting and DebuggingProgramming Patterns
Intermediate
Course content
Join this Course
Sign in to save your progress.
-
Interfaces and Standard Abstractions
-
Interfaces Are Satisfied Implicitly
-
Read and Stream With io.Reader and io.Writer
-
-
-
Context, Timeouts, and Cancellation
-
Use context.Context for Deadlines and Cancellation
-
Set Timeouts on HTTP Clients and Server Handlers
-
-
-
Goroutines, Channels, and Coordination
-
Run Concurrent Work Safely With sync.WaitGroup
-
Coordinate Pipelines and Timeouts With Channels and select
-
-
-
Structured Logging and Databases
-
Write Structured JSON Logs With log/slog
-
Query Relational Data Safely With database/sql
-
-
-
Middleware and Production-Ready Services
-
Wrap HTTP Handlers With Middleware
-
Build a Multi-Route Service With Graceful Shutdown
-
-
-
Generics, Transactions, Timers, and Test Doubles
-
Generics, Constraints, and slices/maps Packages
-
SQL Transactions and Connection Pool Limits
-
Timers, Tickers, and Avoiding time.After Leaks
-
Testing With Interface Fakes, t.TempDir, and testdata
-
-
1.
In `SquareAll`, 4 goroutines write `out[i] = n * n` into a pre-allocated slice `out := make([]int, len(nums))`. Why does `go test -race` pass without a mutex?
2.
What happens if two goroutines write to the same `map[string]int` at the same time without a mutex?
3.
Who should call `close(ch)` on a Go channel?
4.
A producer goroutine tries to send `ch <- msg` on an unbuffered channel, but the receiver already timed out and returned. How do you prevent the producer from leaking forever?
5.
Which channel type uses zero bytes per element when you only need to broadcast a "stop" signal by calling `close(done)`?
About
Five scenario questions on sync.WaitGroup, data races, channel closing, and select with ctx.Done().
- Duration
- 5 min
- Last update
- 11/27/2026
Was this helpful?
0
0
Comments
Sign in to commentNo comments yet.