Go

Context Interview Questions

35 Go interview questions on context, with detailed answers and code.

0/577 known
35 questions
ContextQ263Hard

func main() { parent, cancel := context.WithTimeout(context.Background(), 50*time.Millisecond) defer cancel() child, cancelChild := context.WithCancel(parent) defer…

ContextQ268Medium

type ctxKey string func main() { ctx := context.WithValue(context.Background(), ctxKey("user"), "alice") ctx = context.WithValue(ctx, ctxKey("user"), "bob") child,…

ContextQ270Medium

The official guidance: use context values only for request-scoped data that crosses process and API boundaries , not for passing optional parameters to functions. Good…

Next topicError Handling & panics