IntelliJ IDEA
 
Get IntelliJ IDEA
You are viewing the documentation for an earlier version of IntelliJ IDEA.

Go templates

Last modified: 10 August 2022

Go has its own template engine that is split into two packages: text/template and html/template. These packages are similar in functionality, with the difference that html/template allows a user to generate HTML code that is safe against code injection, making it suitable for use on web pages and emails. Also, these packages provide code assistance in other applications such as the configuration for Helm and the Kubernetes package manager.

To specify mapping of a type between a Go template and an application, IntelliJ IDEA uses the gotype comment of the following structure: {{- /*gotype: package/import/path.type_name*/ -}}.