What should I do if I do not want to use '{{ }}' in template of golang?

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

What should I do if I do not want to use '{{ }}' in template of golang?

问题

我必须出于某种原因同时使用reactgolang。然而,每当我在react中需要使用{{ }}时,golang的模板语法会与golang的模板发生冲突。有没有办法让golang的模板不起作用?这应该是部分生效的,因为我必须使用它。

英文:

I have to use react and golang together for some reason.
However, every time I need to use {{ }} in react, golang's turbulence overlaps with golang's template.
Is there any way that templates in golang will not work?
This should be partial and should not work as a whole because I have to use it.

答案1

得分: 3

只需在解析之前将Go端的分隔符更改为其他内容(例如,您可以使用[[ ]])。

请参阅文档:

https://golang.org/pkg/text/template/#Template.Delims

英文:

Just change the delimiters on the Go side to something else before parsing (for example you could use [[ ]] ).

See the docs:

https://golang.org/pkg/text/template/#Template.Delims

huangapple
  • 本文由 发表于 2017年8月11日 14:09:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/45628094.html
匿名

发表评论

匿名网友

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

确定