英文:
Using Go and Revel, getting error c.RenderArgs is Undefined (possibly outdated?)
问题
我有一个包含过时的revel的Go代码脚本。我遇到了一个错误,错误信息是:
c.RenderArgs undefined (type *revel.Controller has no field or method RenderArgs)
我尝试过搜索,但无法找到要替换的内容以修复这个错误。我对revel不太熟悉,所以这让事情变得更加困难。
如果有人能帮忙,或者简单地给我提供一个可以帮助我的资源(如果我错过了,我很抱歉),我将非常感激!
英文:
I have a script that has some Go code with outdated revel. I ran into an issue that says:
c.RenderArgs undefined (type *revel.Controller has no field or method RenderArgs)
And ive tried to search around, but can't figure out what to replace it with to fix the error. I'm not familiar with revel so its making things that much more difficult.
If someone could help, or simply link me to a space that could help(if i missed it, and i am sorry) i would be greatful!
答案1
得分: 1
使用ViewArgs
代替RenderArgs
。
英文:
Use ViewArgs
instead of RenderArgs
.
答案2
得分: 0
根据你提供的信息,我找到了Revel的Godocs中的相关内容。根据文档中的描述,Render
函数用于渲染与调用Controller方法对应的模板。在渲染模板之前,参数将被添加到c.RenderArgs
中,并以它们的本地标识符作为键。
根据你的描述,我认为你的代码可能在尝试修改一个不再被导出的字段,或者调用一个已经被更改为上述函数的方法。
英文:
Without posting more of your code, your question cannot be accurately answered, but here is what I found in the <a href="https://godoc.org/github.com/robfig/revel#Controller.Render">Godocs for Revel</a>.
> func (c *Controller) Render(extraRenderArgs ...interface{}) Result
>
> Render a template corresponding to the calling Controller method. Arguments will be added to c.RenderArgs prior to rendering the template. They are keyed on their local identifier.
I believe your code is either trying to modify a field that was changed to be no longer exported, or calling a method that has been changed to the one above.
答案3
得分: 0
请检查您的Revel版本和项目依赖的Revel版本。
由于Revel v0.14.1发布,一些变量名已更改。
请查看发布说明。Revel v0.14.1发布说明
英文:
Tokoshiro
Please check your revel version and you project dependence revel version.
Due to revel v0.14.1 released, some variables name are changed.
Please check the release note. revel v0.14.1 release note
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论