prow/cmd/admission/admission.go
func writeResponse(ar admissionapi.AdmissionRequest, w io.Writer, decide decider) error {
	response, err := decide(ar)
	if err != nil {
		logrus.WithError(err).Error("failed decision")
		response = &admissionapi.AdmissionResponse{
			Result: &meta.Status{
				Message: err.Error(),
			},
		}
	}
	var result admissionapi.AdmissionReview
	result.Response = response
	result.Response.UID = ar.UID
	out, err := json.Marshal(result)
	if err != nil {
		return fmt.Errorf("encode response: %v", err)
	}
	if _, err := w.Write(out); err != nil {
		return fmt.Errorf("write response: %v", err)
	}
	return nil
}
func writeResponse(ar admissionapi.AdmissionRequest, w io.Writer, decide decider) error {
	response, err := decide(ar)
	if err != nil {
		logrus.WithError(err).Error("failed decision")
		response = &admissionapi.AdmissionResponse{
			Result: &meta.Status{
				Message: err.Error(),
			},
		}
	}
	var result admissionapi.AdmissionReview
	result.Response = response
	result.Response.UID = ar.UID
	out, err := json.Marshal(result)
	if err != nil {
		return fmt.Errorf("encode response: %v", err)
	}
	if _, err := w.Write(out); err != nil {
		return fmt.Errorf("write response: %v", err)
	}
	return nil
}
func writeResponse ( ar admissionapi . AdmissionRequest , w io . Writer , decide decider ) error { response , err := decide ( ar ) if err != nil { logrus . WithError ( err ) . Error ( " " ) response = & admissionapi . AdmissionResponse { Result : & meta . Status { Message : err . Error ( ) , } , } } var result admissionapi . AdmissionReview result . Response = response result . Response . UID = ar . UID out , err := json . Marshal ( result ) if err != nil { return fmt . Errorf ( " " , err ) } if _ , err := w . Write ( out ) ; err != nil { return fmt . Errorf ( " " , err ) } return nil }
// writeResponse gets the response from onlyUpdateStatus and writes it to w.
writeResponse gets the response from onlyUpdateStatus and writes it to w .