A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-127.go
1packagemain
2
3import"fmt"
4
5funcmain(){
6deferfunc(){
7r:=recover()
8fmt.Printf("%v\n",r)
9}()
10vars[]int
11_=s[3]
12}
Defer
Answer & explanation
Console output
runtime error: index out of range [3] with length 0
Why
Indexing the nil slice at position 3 (length 0) triggers a runtime panic carrying a runtime.Error value. The deferred recover() captures it, and %v prints the error’s deterministic message text describing the out-of-range access.