why? is this just so that you can convert the Error field so it gets encoded? a) if so then the method shouldn't be called structToMap which hides the actual intent of the method  b) this is a bad way of doing this, just use EncodableError to store the error and it'll get encoded properly (and you can always have EncodableError implement MarshalJSON to customise that encoding if you need to)