With Go\'s context package it is possible to pass request-specific data to the stack of request handling functions using
func WithValue(parent C
Yes, you're correct, you'll need to call WithValue() passing in the results each time. To understand why it works this way, it's worth thinking a bit about the theory behind context's.
A context is actually a node in a tree of contexts (hence the various context constructors taking a "parent" context). When you request a value from a context, you're actually requesting the first value found that matches your key when searching up the tree, starting from the context in question. This means that if your tree has multiple branches, or you start from a higher point in a branch, you could find a different value. This is part of the power of contexts. Cancellation signals, on the other hand, propagate down the tree to all child elements of the one that's canceled, so you can cancel a single branch, or cancel the entire tree.
For an example, here's a context tree that contains various things you might store in contexts:
The black edges represent data lookups, and the grey edges represent cancelation signals. Note that they propogate in opposite directions.
If you were to use a map or some other structure to store your keys, it would rather break the point of contexts. You would no longer be able to cancel only a part of a request, or eg. change where things were logged depending on what part of the request you were in, etc.
TL;DR — Yes, call WithValue several times.