Go Interview Questions and Answers

Goroutines, channels, interfaces, tooling and idiomatic Go.

Practise 10 random 3 peer-reviewed questions
Go Interview Syllabus & Preparation Strategy

Whether you are preparing for entry-level Go interview questions for freshers or senior software engineer interview questions addressing concurrency, scalability, and system architecture, this track provides peer-reviewed model answers with syntax walkthroughs, edge cases, and practical interview tips.

1 How do slices differ from arrays in Go? Easy

An array has a fixed length that is part of its type: [4]int and [5]int are different types, and copying an array copies all elements.

A slice is a small descriptor with three fields: a pointer to an underlying array, a length and a capacity. Slices are what you use almost everywhere because they can grow.

arr := [3]int{1, 2, 3} // array, fixed
sl := []int{1, 2, 3}   // slice
sl = append(sl, 4)     // grows, may reallocate
sub := sl[1:3]         // shares the same backing array

Because sub shares memory, writing to sub[0] changes sl[1]. append reallocates when capacity is exceeded, so two slices can unexpectedly stop aliasing. Arrays are comparable with ==; slices are not comparable except to nil. Use arrays when the size is fixed and part of the contract, and slices for almost everything else.

2 What is the difference between new and make in Go? Easy

new(T) allocates zeroed memory for a value of type T and returns a pointer *T. It works for any type and is rarely used.

make only works for slices, maps and channels. It returns an initialised value of that type (not a pointer) and lets you set length and capacity.

p := new(int)          // *int, points to 0
s := make([]int, 0, 8) // len 0, cap 8
m := make(map[string]int)
ch := make(chan int, 4)

The distinction exists because slices, maps and channels need runtime initialisation before use. A zeroed map is nil, and writing to a nil map panics. new(map[string]int) returns a pointer to a nil map, which is almost never what you want. In practice people skip new for structs and take the address of a composite literal instead, for example &User{}.

3 What are zero values in Go and why do they matter? Easy

Go has no uninitialised variables. Every type has a defined zero value: 0 for numeric types, false for bool, the empty string for string, nil for pointers, slices, maps, channels, interfaces and functions, and a struct whose fields are all zero.

var n int          // 0
var s string       // ""
var p *int         // nil
type User struct{ Name string; Age int }
var u User         // {"" 0}

Because of zero values, most types are usable immediately and code can often skip constructors entirely. Idiomatic Go leans on this: a zero sync.Mutex is unlocked and ready, and a zero bytes.Buffer is empty and ready.

There are subtleties. A nil map can be read from but writing panics, so you must call make first. A nil slice can be appended to (append allocates) and ranged over safely, so var xs []int is often preferred over []int{}. Zero values are also why APIs such as errors.New work without extra setup.

Frequently Asked Questions About Go Interviews

What do hiring managers evaluate in Go technical rounds?

Technical interviewers look for foundational fluency, idiomatic syntax, clarity when communicating complex logic, and awareness of performance trade-offs (e.g. memory footprint, render performance, and network latency) in production environments.

What are the best interview tips for practicing Go questions?

Use active recall: summarize each answer in your own words before revealing the model solution. Focus on explaining why a certain approach is chosen rather than just memorizing code syntax.