package res import "encoding/json" type response struct { Code int Message string Uuid string Data interface{} `json:"data,omitempty"` } func Get_res_string(Code int, Message string, Uuid string, Data ...interface{}) string { var res = new(response) res.Code = Code res.Message = Message res.Uuid = Uuid res.Data = Data res_str, err := json.Marshal(res) if err != nil { panic(err) } return string(res_str) }