英文:
What should I do if I do not want to use '{{ }}' in template of golang?
问题
我必须出于某种原因同时使用react
和golang
。然而,每当我在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:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论