在 Go Runtime 中,我使用 c.Infof 方法記錄消息,但編譯失敗,出現(xiàn)以下錯誤 c.Infof undefined (type context.Context has no field or method Infof)。錯誤清楚地表明從c := appengine.NewContext(r)返回的應(yīng)用引擎上下文是context.Context類型,并且它沒有方法c.Infof。但與此相反,https: //godoc.org/google.golang.org/appengine/log 中的文檔表明此方法存在。還有一點(diǎn)要注意,該方法存在于"appengine"(import "appengine")包返回的上下文中,而在新包google.golang.org/appengine返回的上下文中似乎不存在該方法,在包“google.golang.org/appengine”返回的 context.Context 類型的新 Context 上,c.Infof等效于什么?
- 1 回答
- 0 關(guān)注
- 285 瀏覽
添加回答
舉報(bào)
0/150
提交
取消