The go http package only supports the status code from RFC 2616. A lot of REST apis like github use 422 for bad input data. I would like to also do this, but I don't see a good way of doing this in go. The options I see are
Edit the source code to the http package and add it. This would be easy to do but would be bad to edit a core library.
The http.Response struct has Status as a string StatusCode as an int. I think I could just set them in the responsce, but the http.Handler only has a RespnseWriter interface. It might be possible to make a http.Transport that has a RoundTripper that correctly sets the Response. Even if it is possible this seem like it would be a hacky to some degree.
So what is the best way of adding a custom http status code to go, or is it just a bad idea?