Skip to content

Go template linter and formatter

djLint lints and formats Go templates. Set the golang profile so the rules and the formatting fit them.

What are Go templates?

Go templates (text/template, html/template) also power Hugo themes and Helm charts, so use this same profile for them.

Terminal window
djlint /path/to/templates --profile=golang

Configure djLint in your project’s pyproject.toml, djlint.toml / .djlint.toml, or .djlintrc file.

pyproject.toml
[tool.djlint]
profile = "golang"
djlint.toml / .djlint.toml
profile = "golang"
.djlintrc
{ "profile": "golang" }