Say I want to represent HTTP headers with a struct, something like:
Headers struct {
'x-requested-by' 'foo'
}
it definitely does not like a variable name with hyphens, etc. Any way around this?
Specify actual header names as field tags and use those field tags when encoding or decoding the struct to the wire. See the encoding/json package for an example of how to do this.
If the higher-level problem is storing key-value pairs with arbitrary string keys, then use a map.