golang recover from panic situation: - reflect: call of reflect.Value.Elem on struct Value

前端之家收集整理的这篇文章主要介绍了golang recover from panic situation: - reflect: call of reflect.Value.Elem on struct Value前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

recover from panic situation: - reflect: call of reflect.Value.Elem on struct Value

golang报错
recover from panic situation: - reflect: call of reflect.Value.Elem on struct Value

原因是该传,指针的地方没传。


electronicBook := model.ElectronicBook{}
	err = req.ReadEntity(&electronicBook)
	if err != nil {
		res.AddHeader("Content-Type","application/json")
		res.WriteErrorString(http.StatusBadRequest,err.Error())
		return
	}
	err = c.service.Insert(gliHeader.UserID,&electronicBook)

猜你在找的Go相关文章