最近发布的主题
最近发布的文章
暂无
最近分享的资源
暂无
最近发布的项目
暂无
最近的评论
-
已解决 // lanuch.json ``` { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Launch file", "type": "go", "request": "launch", "mode": "debug", "skipFiles": ["${workspaceFolder}/cmd/basic_resource/wire.go"], "program": "${workspaceFolder}/cmd/basic_resource", "args": ["-conf", "${workspaceFolder}/configs/"] } ] } ```
-
我的结论是如果要记录消耗时间,使用interceptor这种方案是无效的。 目前的做法是只记录请求数据和相应数据,请求消耗的时间不做记录。 即在w.write所在的方法里打印log。 func success(w http.ResponseWriter, r *http.Request, message string, data interface{}) { w.Header().Set("content-type","application/json") w.WriteHeader(http.StatusOK) output := make(map[string]interface{}) output["result"] = true output["message"] = message output["data"] = data outputJson, _ := json.Marshal(output) w.Write(outputJson) logReqAndRes(output,r) }
-
评论了主题 golang 里'' 和"" 使用上区别是什么?
-
谢谢,找到原因了,SmsResponse构造错了 error ``` type ( SmsResult struct { RequestId string `json:"RequestId"` Code string `json:"Code"` Message string `json:"Message"` BizId string `json:"BizId"` } SmsResponse struct { SendSmsResponse SmsResult `json:"SendSmsResponse"` } ) ``` correct ``` type ( SmsResponse struct { RequestId string `json:"RequestId"` Code string `json:"Code"` Message string `json:"Message"` BizId string `json:"BizId"` } ) ```