This is an old revision of the document!
Table of Contents
Senior Golang Live Coding Tests
This document contains 5 live coding interview tests for Senior Golang developers, focused on concurrency, system design, and real-world Go usage.
1. Worker Pool with Goroutines and Channels
Problem
Create a program that:
Receives a list of jobs (integers)
Starts N worker goroutines
Each worker processes jobs concurrently
Each job simulates work using time.Sleep
Each job returns jobID * 2
Collects results safely (no data race)
What This Tests
Goroutines and channels
sync.WaitGroup
Worker pool pattern
Concurrency safety
Senior-Level Extensions
Add context.Context to cancel all workers
Add per-job timeout
Graceful worker shutdown
Notes
Worker pool /ˈwɜːrkər puːl/: a fixed number of workers processing tasks from a queue
Goroutine /ˌɡoʊˈruːtiːn/: lightweight concurrent function in Go
Data race /ˈdeɪtə reɪs/: concurrent access to shared data without synchronization
2. Rate Limiter (Token Bucket)
Problem
Implement a rate limiter that:
Allows at most X requests per second
Rejects or blocks requests when the limit is exceeded
Is safe for concurrent access
What This Tests
Time-based logic
Concurrent-safe design
Understanding of rate-limiting algorithms
Senior-Level Extensions
Support burst traffic
Use time.Ticker
Make limits configurable at runtime
Notes
Rate limiter /reɪt ˈlɪmɪtər/: controls how often an action can occur
Token bucket /ˈtoʊkən ˈbʌkɪt/: algorithm that allows requests based on available tokens
Burst /bɜːrst/: many requests arriving at once
3. Concurrent URL Fetcher
Problem
Write a function that:
Accepts a list of URLs
Fetches them concurrently
Limits concurrency to N requests at a time
Returns results and errors separately
What This Tests
Fan-out / fan-in concurrency pattern
Error handling in concurrent systems
Goroutine coordination
Senior-Level Extensions
Retry failed requests with backoff
Cancel remaining requests on fatal error
Add request timeout using context
Notes
Fan-out / Fan-in /fæn aʊt | fæn ɪn/: splitting work and merging results
Backoff /ˈbækˌɔːf/: increasing delay between retries
Concurrency limit /kənˈkʌrənsi ˈlɪmɪt/: maximum number of parallel tasks
4. Thread-Safe In-Memory Cache with TTL
Problem
Implement an in-memory cache that:
Stores key-value pairs
Supports TTL (time to live)
Is safe for concurrent reads and writes
What This Tests
sync.Mutex / sync.RWMutex
Data consistency
Time-based expiration
Senior-Level Extensions
Background cleanup goroutine
LRU eviction strategy
Cache hit/miss metrics
Notes
TTL (Time To Live) /ˌtiː tiː ˈɛl/: how long data remains valid
Eviction /ɪˈvɪkʃən/: removing old or expired data
Thread-safe /θred seɪf/: safe for concurrent access
5. Graceful HTTP Server Shutdown
Problem
Create an HTTP server that:
Handles requests normally
Listens for OS signals (SIGINT, SIGTERM)
Shuts down gracefully without dropping in-flight requests
What This Tests
Real-world Go server handling
Signal handling
http.Server.Shutdown
Senior-Level Extensions
Add shutdown timeout
Log active connections
Cancel request contexts on shutdown
Notes
Graceful shutdown /ˈɡreɪsfəl ˈʃʌtdaʊn/: stopping a system without interrupting active work
In-flight request /ɪn flaɪt rɪˈkwɛst/: a request currently being processed
Signal handling /ˈsɪɡnəl ˈhændlɪŋ/: reacting to OS signals
