package response type MessageCode int const ( // HTTP Default Message CodeSuccess MessageCode = 1000 CodeCreated MessageCode = 1001 CodeAccepted MessageCode = 1002 CodeNoContent MessageCode = 1003 CodeRedirect MessageCode = 1004 CodeDataFormat MessageCode = 1005 CodeUnauthorized MessageCode = 1006 CodeForbidden MessageCode = 1007 CodeNotFound MessageCode = 1008 CodeInternalError MessageCode = 1009 // Custom Message ) var code map[MessageCode]string func init() { code = map[MessageCode]string{ CodeSuccess: "Success", CodeCreated: "Created", CodeAccepted: "Accepted", CodeNoContent: "No Content", CodeRedirect: "Moved Permanently", CodeDataFormat: "Data Format Error", CodeUnauthorized: "Unauhorized", CodeForbidden: "Forbidden", CodeNotFound: "Not Found", CodeInternalError: "Internal Error", } } func GetCodeMessage(c MessageCode) (MessageCode, string) { if r, ok := code[c]; ok { return c, r } return c, "" }