gpt4 book ai didi

templates - 多路平等测试失败

转载 作者:IT王子 更新时间:2023-10-29 02:17:41 24 4
gpt4 key购买 nike

所以我在 go 模板中进行了以下等式测试

{{if eq .user.Role "Manager""Admin"}}

这应该根据 docs 工作和 1.2 release notes , 但我没有任何运气

为了更清楚 .user.Role "Manager"可以工作,或者任何只涉及一个参数的相等性测试。所以像{{if eq 1 1}} 计算正确,但 {{if eq 1 2 1}} 不正确。

我得到的错误是 3: executing ".../index.html"at : wrong number of args for eq: want 2 got 3

最佳答案

好的,所以最终的解决方案是取消注释 revel 在 template.go 中的 eq 实现。 .

关于templates - 多路平等测试失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21281837/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com