Go (Golang) Interview Questions
Goroutines, channels, select, slices & maps, interfaces, structs, error handling, defer/panic/recover, the scheduler, generics, context and concurrency.
73 questions
Popular Searches
1. What is Go and what problems was it designed to solve?
easyLanguage Fundamentals 6 mins2. What are goroutines and how do they differ from OS threads?
mediumConcurrency 7 mins3. What are channels in Go and how do they enable communication between goroutines?
mediumConcurrency 7 mins4. What is the difference between buffered and unbuffered channels in Go?
mediumConcurrency 6 mins5. What is the select statement in Go and when do you use it?
mediumConcurrency 6 mins6. What is a slice in Go and how does it differ from an array?
easyData Structures 6 mins7. How does the underlying array, length, and capacity of a Go slice work?
mediumSlices 7 mins8. What is a map in Go and is it safe for concurrent use?
mediumMaps 7 mins9. What are Go interfaces and how does implicit implementation work?
mediumInterfaces 7 mins10. What is the empty interface (interface{} / any) in Go and when is it used?
mediumInterfaces 7 mins11. What is a struct in Go and how does struct embedding provide composition?
mediumStructs 7 mins12. What is the difference between a value receiver and a pointer receiver in Go?
mediumMethods 7 mins13. How does error handling work in Go and why does it not use exceptions?
mediumError Handling 7 mins14. What are panic, recover, and defer in Go and how do they interact?
hardError Handling 8 mins15. How does the defer statement work and in what order do deferred calls run?
mediumControl Flow 7 mins16. What is the Go garbage collector and how does it manage memory?
mediumMemory Management 7 mins17. What is escape analysis in Go and how does it decide stack vs heap allocation?
hardMemory Management 8 mins18. What is a WaitGroup in Go and how does it coordinate goroutines?
easyConcurrency 6 mins19. What is a Mutex in Go and how does it differ from a channel for synchronization?
mediumConcurrency 6 mins20. What is the Go memory model and what does the happens-before relationship mean?
hardConcurrency 7 mins21. What is a context in Go and how is it used for cancellation and deadlines?
mediumStandard Library 6 mins22. What is the difference between concurrency and parallelism in Go?
mediumConcurrency 7 mins23. How does the Go scheduler work with its GMP model?
hardRuntime 9 mins24. What are Go generics and how do type parameters and constraints work?
mediumGenerics 7 mins25. What is the difference between make and new in Go?
easyMemory & Types 6 mins26. How do you detect and avoid race conditions in Go?
mediumConcurrency 7 mins27. What is a nil pointer, nil slice, and nil map in Go and how do they behave?
mediumTypes & Nil 7 mins28. What are Go modules and how does dependency management work?
mediumModules & Tooling 7 mins29. What is the difference between exported and unexported identifiers in Go?
easyLanguage Basics 6 mins30. How does Go handle testing and what does the testing package provide?
mediumTesting 7 mins31. What is a goroutine leak and how do you detect one in production?
hardConcurrency Debugging 9 mins32. How does context cancellation propagate through a Go call tree, and where does propagation typically break?
hardConcurrency Debugging 9 mins33. What causes channel deadlocks in Go, and what are the subtle pitfalls of select?
hardConcurrency Debugging 10 mins34. When should you use sync.Pool, and how does it interact with escape analysis and the GC?
hardPerformance 10 mins35. How does the Go race detector work, and what are its limits in a real codebase?
hardTesting and Debugging 10 mins36. How does slice aliasing with append cause surprising bugs in Go, and how do you avoid them?
hardData Structures 10 mins37. Why can a Go interface value be non-nil while holding a nil pointer, and how do you avoid the trap?
hardType System 9 mins38. How do you design error wrapping in Go, and when do you use errors.Is versus errors.As?
mediumError Handling 9 mins39. How do you profile a Go service with pprof to find a real bottleneck?
hardPerformance 11 mins40. How do you implement graceful shutdown in a Go service so in-flight work is not lost?
hardProduction Operations 11 mins41. Why does GOMAXPROCS matter when running Go in containers with CPU limits?
hardRuntime Configuration 9 mins42. How do you tune the Go garbage collector with GOGC and GOMEMLIMIT in a memory-constrained service?
hardRuntime Configuration 10 mins43. How do you write Go benchmarks you can actually trust, and what makes a benchmark misleading?
hardPerformance Testing 9 mins44. How do you configure timeouts and connection reuse correctly for net/http servers and clients in Go?
hardNetworking 10 mins45. How does the database/sql connection pool behave in Go, and how do you configure it for a production service?
hardData Access 10 mins46. When do you reach for the Go execution tracer instead of pprof, and what does it show you?
hardPerformance Debugging 10 mins47. When does sync.RWMutex hurt more than it helps, and what are the alternatives under contention?
hardConcurrency Performance 10 mins48. How do you bound concurrency and propagate the first error across parallel work in Go?
hardConcurrency Patterns 10 mins49. What goes wrong with encoding/json in production Go services, and how do you handle it?
hardSerialisation 10 mins50. How do you manage dependency upgrades, private modules and supply-chain safety in Go?
hardModules and Tooling 10 mins51. How do you build small, reproducible Go binaries for containers, and what breaks with CGO and cross-compilation?
hardBuild and Deployment 10 mins52. How do you keep a large Go test suite deterministic, parallel and free of flakes?
hardTesting Practice 10 mins53. How does sync.Once work, and where does lazy initialisation go wrong in Go?
mediumSynchronisation 8 mins54. When should you use sync/atomic instead of a mutex in Go?
hardSynchronisation 9 mins55. How do goroutine stacks grow in Go, and what does that cost?
hardRuntime Internals 9 mins56. Why can time.After leak in a select loop, and what should you use instead?
mediumConcurrency Patterns 8 mins57. How do method sets and addressability decide whether a Go type satisfies an interface?
hardType System 8 mins58. What does reflection cost in Go, and when is it justified?
hardPerformance 9 mins59. How do struct field alignment and padding affect memory use in Go?
mediumMemory Layout 8 mins60. Why do string and []byte conversions allocate in Go, and how do you avoid the cost?
mediumPerformance 8 mins61. How does a Go map grow, and why does deleting keys not return memory?
hardData Structures 9 mins62. When is sync.Map the right choice over a mutex-guarded map in Go?
hardConcurrency 9 mins63. What are the rules for using unsafe.Pointer, and where does runtime.KeepAlive come in?
hardLow-Level Go 9 mins64. What does cgo actually cost in a Go service, and when would you still use it?
hardInteroperability 9 mins65. How do build tags and cross-compilation work in Go, and where do they bite?
mediumBuild and Tooling 8 mins66. How do you tune http.Transport for outbound traffic in a Go service?
hardNetworking 9 mins67. What are the io.Reader and io.Writer contracts, and how do people break them?
mediumStandard Library 8 mins68. What goes wrong with t.Parallel and table-driven subtests in Go?
mediumTesting 8 mins69. Which GODEBUG and runtime knobs actually help during a Go production incident?
hardProduction Debugging 8 mins70. Why does a panic in a background goroutine kill the whole Go process, and how do you handle it?
mediumError Handling 8 mins71. How do vendoring, go.sum and workspaces change what a Go build actually compiles?
hardModules and Build 9 mins72. How does profile-guided optimisation work in Go, and how would you adopt it?
hardPerformance 9 mins73. How do you design a worker pool with real backpressure in Go?
hardConcurrency Patterns 9 mins