2021-12-13发表2022-09-08更新Golang Echo框架实现API统一返回格式Golang的Echo框架中,上下文echo.Context是一个接口,可以通过它重写默认的Context.JSON方法来自定义返回格式 首先定义一下接口的格式 1234type CommonResponse struct { Message string `json:"message"` Data interface{} `json:"data,omitempty"`}阅读更多