package oci import ( "encoding/json" "net/http" ) type ociErrorEntry struct { Code string `json:"code"` Message string `json:"message"` } type ociErrorResponse struct { Errors []ociErrorEntry `json:"errors"` } func writeOCIError(w http.ResponseWriter, code string, status int, message string) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(status) _ = json.NewEncoder(w).Encode(ociErrorResponse{ Errors: []ociErrorEntry{{Code: code, Message: message}}, }) }