The Go (Intermediate) test is for developers who write Go for a living, or are about to. It goes past the syntax into the behaviour that decides whether Go code is correct: what append does when two slices share an array, whether a nil pointer stored in an error compares equal to nil, when a deferred call reads its arguments, and which channel operations block, panic or deadlock. The multiple-choice questions come first, and most of them show a short, complete program and ask what it prints, or whether it compiles at all. Coding problems follow, and you solve them in Go.
Sit it when you can read an unfamiliar Go program and say what it will do before you run it. If you are still getting used to slices, maps and methods, start with the Go (Basic) test; neither level requires the other.
What each topic examines
Questions are drawn evenly across the topics below, so a sitting cannot be all channels and no maps. Each bullet says what you should be able to predict or explain.
- Types, variables and constants. How
iotacounts through aconstblock, how constant arithmetic differs from arithmetic on sized integers at run time, integer division and remainder with negative operands, a defined type against an alias, and what:=declares when the name already exists in an outer scope. - Control flow.
fallthrough, labelledbreakandcontinue, what an unlabelledbreakinside aswitchleaves, and when arangeloop evaluates the thing it ranges over. - Functions and closures. Closures that keep their own state, method values and when they bind their receiver, passing a slice to a variadic parameter with
..., and named results with a barereturn. - Arrays and slices. Two slices over one backing array,
appendand spare capacity, the full slice expressions[low:high:max],copy, and which bounds a slice expression is checked against. Practise on array problems and read the Arrays lesson. - Maps. Passing a map to a function, reading from and writing to a nil map, comma-ok lookups, deleting while ranging, and updating a struct stored as a map value. See the hash table problems and the Hashing lesson.
- Strings, bytes and runes. Byte length against rune count, what
rangeyields over UTF-8, immutability, and howstringsandstrconvbehave at the edges. See the string problems and the Strings lesson. - Structs and methods. Value and pointer receivers, addressability, embedding and promotion, including what a promoted method sees when the outer type has a method of the same name, and what assigning a struct that holds a slice or a pointer copies.
- Interfaces. Method sets and which types satisfy an interface, nil pointers stored in interfaces, type assertions and type switches, and comparing interface values.
- Errors, defer, panic and recover. Wrapping with
%wagainst formatting with%v,errors.Isanderrors.As, when deferred arguments are evaluated, deferred closures and named results, and where a call torecovertakes effect. - Goroutines and channels. Unbuffered hand-offs against buffered queues, closing a channel and receiving from a closed one,
rangeover a channel, directional channel types, and the deadlock the runtime reports when every goroutine is blocked. - sync, select and context.
selectwithdefaultand with nil channels,sync.WaitGroup,sync.Mutexandsync.Once, and how cancellation travels between acontextand the contexts derived from it. - Generics. Type parameters and constraints,
comparable,~in a union, type inference and its limits, and generic types with methods.
How the questions are written
Most questions show a complete program, package main and all, and ask for its output, which was checked by running it on Go 1.19. Nothing depends on what varies from run to run: no question prints a map in iteration order, relies on a scheduling race, or asks for a slice's exact capacity after append has grown it, because the language does not fix any of those. Concurrent programs print one determined result, with values passed through channels in a set order or summed after wg.Wait().
"It does not compile", "It panics" and the runtime's "fatal error: all goroutines are asleep - deadlock!" appear among the options as real answers, not filler. You need to know which mistakes the compiler catches, which survive until run time, and what the runtime does with each, because a wrong program in Go fails in one of those three ways and the questions ask which. A few questions ask you to select every correct option, and only the exact set scores.
The coding problems
The coding problems come from the published catalogue and must be answered in Go. As in the practice workbench, you complete a function whose signature is given and return the answer; the judge supplies the input and runs hidden cases, each case you pass earns its share of the marks, and your best submission per problem stands.
Write for Go 1.19. There are no built-in min and max functions and no slices or maps packages, so sort with sort.Ints, sort.Strings or sort.Slice, and keep a two-line max helper in your head. A priority queue in Go means implementing container/heap's five methods on your own type, which is slow to work out under a clock if you have never done it. Build long output with strings.Builder rather than += in a loop. int is 64 bits on the judge, so most sums are safe, but a product of two large values can still overflow, and Go wraps it without any error.
How to prepare
Predict, then run. For each behaviour in the list above, write a ten-line program, decide what it will print, and only then run it. Most of the surprises in Go come from a handful of rules (slices share arrays, assignment copies, an interface carries a type as well as a value), and seeing each rule break your prediction once is how it sticks.
Solve problems in Go, not in your strongest language. The challenge catalogue takes a Go solution for every problem; the topic hubs order their problems from easy to hard, and a good spread for Go practice is two pointers, sliding window, stack, heap and breadth-first search. The DSA roadmap teaches the techniques behind them, with lessons such as Two Pointers, Sliding Window and Heaps and Priority Queues.
Concurrency has no problem set, so build the shapes yourself: a pipeline of stages joined by channels, a worker pool that waits on a sync.WaitGroup, a loop that stops when a context is cancelled, and a select that drains two channels until both are closed. Run them with the race detector (go run -race), and try the broken versions too: forget a close, pass a WaitGroup by value, lock a mutex twice. Knowing what each failure looks like is part of what the test examines.