Go (Golang) Interview Questions and Answers

Go interviews test whether you think in Go: small interfaces, composition over inheritance, explicit error values and zero values that are useful. Expect questions on slices versus arrays, maps, pointers, defer, panic and recover, and how method sets and interfaces interact.

Concurrency is the centre of gravity: goroutines and the scheduler, channels (buffered and unbuffered), select, sync primitives, the context package for cancellation and deadlines, data races and how to find them. Senior rounds add profiling, memory and garbage collection, and structuring services.

Questions

Related

Frequently asked questions

What is a goroutine?

A lightweight function execution managed by the Go runtime scheduler, not by the operating system. Thousands can run on a few OS threads because they start small and are multiplexed.

Buffered versus unbuffered channels?

An unbuffered channel makes sender and receiver meet (synchronise); a buffered channel lets senders continue until the buffer is full.

How do you avoid data races in Go?

Share memory by communicating over channels, protect shared state with sync.Mutex or atomic operations, and run tests with the race detector (go test -race).