GOTMPLFMT(1)
π GOTMPLFMT(1) β the Go template glow-up page π
Ok so bestie, welcome to gotmplfmt β a little gem from the Go manual crew. This is gonna be fun, I promise. π
β¨ NAME β¨
gotmplfmt β format Go HTML template files. Yeah, that's literally it, and it's iconic for it. π¦
πΈ SYNOPSIS πΈ
gotmplfmt [FILE]...
π DESCRIPTION π
So gotmplfmt formats Go HTML template files from FILE. π« And if you don't give it any file at all? No worries, she just reads from standard input. Lowkey the most chill behaviour ever. π«Ά
The zone gets formatted according to these rules, and honestly, the way that it follows structure is giving main character energy:
- tabs are used for indentation (tabs!! not spaces!! don't start anything with me on this π )
- the structure of open HTML tags and template verbs is followed, except for
html,body,head,meta,mainornavtag β those ones are the exceptions, iykyk - before a
{{block}}or{{define}}an extra newline is introduced β¨ (yes, an extra one, she's extra like that)
β οΈ ngl bestie, read this one carefully: you can use this on Go text templates, but as whitespace is significant there, it will lead to "corrupt" output. π So fr fr, HTML templates only, unless you like chaos. π
π OPTIONS π
There are is one options (and a debugging one) β yes we're keeping that phrasing, it's iconic, don't @ me. π
-wWIDTH β use WIDTH as line width πβ¨-tβ show the lexed tokens (the debugging one, she's nosy and we love her for it) ππ
π EXAMPLE π
Look at this cute little pipeline, it's literally so satisfying:
% cat <<'EOF' | ./gotmplfmt
{{- if .Flash}} BLAAT {{else if not .Flash}} {{hallo}} {{meer}} BLOET {{end -}}
EOF
Returns:
{{- if .Flash}}
BLAAT
{{else if not .Flash}}
{{hallo}}{{meer}} BLOET
{{end -}}
See?? π The messy one-liner became a whole structured masterpiece. Obsessed. π
π§ AUTHOR π§
Miek Gieben miek@miek.nl β¨mailto:miek@miek.nlβ©. Legend behaviour, no cap. ππ
Ok that's the whole page, bestie β go format something pretty. And for the official receipts: this is from user commands, dated June 2025, version vibes courtesty of GOTMPLFMT(1). Slay, bye! π¦β¨π
π¦ where this page comes from
- nixos 26.05: gotmplfmt 1.0.25
- nixpkgs unstable: gotmplfmt 1.0.25
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms