Golang / GoLang System Architecture and Testing Interview Questions
What microservice design patterns are most important to understand for Go interviews?
Senior Go interviews probe whether you can design systems that are resilient, observable, and maintainable at scale. These patterns recur across every production Go microservice.
| Pattern | Problem Solved | Go Implementation |
|---|---|---|
| Circuit Breaker | Prevent cascade failures when a downstream is slow/dead | sony/gobreaker or custom state machine |
| Bulkhead | Isolate failures — one slow dependency shouldn't affect others | Separate goroutine pools / semaphores per dependency |
| Retry + Backoff | Transient failures in distributed systems | grpc RetryPolicy or manual exponential backoff |
| Saga / Outbox | Distributed transactions without 2PC | Event sourcing + idempotent consumers |
| Sidecar | Cross-cutting concerns without modifying service | Envoy/Linkerd proxies, Dapr |
| Health Check Aggregator | K8s readiness = all dependencies healthy | Custom /readyz checking DB, cache, downstream |
| Strangler Fig | Gradual migration from monolith | Route by feature flag; run old+new in parallel |
// Circuit breaker with sony/gobreaker import "github.com/sony/gobreaker" type UserClient struct { grpc pb.UserServiceClient cb *gobreaker.CircuitBreaker } func NewUserClient(grpc pb.UserServiceClient) *UserClient { cb := gobreaker.NewCircuitBreaker(gobreaker.Settings{ Name: "user-service", MaxRequests: 3, // requests in half-open state Interval: 10 * time.Second, // reset window for counting Timeout: 30 * time.Second, // how long to stay open ReadyToTrip: func(c gobreaker.Counts) bool { return c.ConsecutiveFailures >= 5 }, }) return &UserClient{grpc: grpc, cb: cb} } func (c *UserClient) GetUser(ctx context.Context, id int64) (*pb.User, error) { result, err := c.cb.Execute(func() (any, error) { return c.grpc.GetUser(ctx, &pb.GetUserRequest{Id: id}) }) if err != nil { if errors.Is(err, gobreaker.ErrOpenState) { return nil, fmt.Errorf("user service unavailable (circuit open): %w", err) } return nil, err } return result.(*pb.User), nil }
More Related questions...