jjzjj

GetStoreFromRequest

全部标签

performance - Golang - 传递和返回变量的最佳实践

我是golang的新手,我正在尝试使用julienschmidt/httprouter创建一个web项目。我正在寻找创建一个格式良好且结构良好的项目,所以我有两个关于性能传递和返回值或指针的问题。在我的例子中,我想创建一个从请求返回一个对象的函数,所以我创建了它://StoreControllerfunc(storeController*StoreController)New(whttp.ResponseWriter,r*http.Request){store,err:=utilities.GetStoreFromRequest(r)//otherstuffreturn}//Utili