code: func sendResponse(rw http.ResponseWriter, code int, resp interface{}) {
  	enc, err := json.Marshal(resp)
  	if err != nil {
  		log.Errorf("Failed JSON-encoding HTTP response: %v", err)
  		rw.WriteHeader(http.StatusInternalServerError)
  		return
  	}
  
  	rw.Header().Set("Content-Type", "application/json")
  	rw.WriteHeader(code)
  
  	_, err = rw.Write(enc)
  	if err != nil {
  		log.Errorf("Failed sending HTTP response body: %v", err)
  	}
  }
docs: // sendResponse attempts to marshal an arbitrary thing to JSON then write
  // it to the http.ResponseWriter