package ecode const ( COMMON_OK = iota PARAM_ERROR ) var COMMON_MEG = map[int]string{ COMMON_OK: "OK", PARAM_ERROR: "参数错误", } func Common(id int) *Ecode { code := new(Ecode) code.Code = id code.Msg = COMMON_MEG[id] return code }