使用Go和Revel时,出现错误c.RenderArgs未定义(可能过时了?)

huangapple go评论98阅读模式
英文:

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

huangapple
  • 本文由 发表于 2017年3月30日 07:01:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/43105676.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定