1

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.

ChrisM
  • 1,576
  • 6
  • 18
  • 29
Jun
  • 216
  • 1
  • 13
  • 3
    Possible duplicate of [How do I escape “{{” and “}}” delimiters in Go templates?](https://stackoverflow.com/questions/17641887/how-do-i-escape-and-delimiters-in-go-templates) – Jonathan Hall Aug 11 '17 at 07:28
  • Externalize your React stuff from your templates and use something like [go.rice](https://github.com/GeertJohan/go.rice) to embed your resources. – Markus W Mahlberg Aug 11 '17 at 07:40

1 Answers1

3

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

Kenny Grant
  • 9,360
  • 2
  • 33
  • 47