GOTMPLFMT(1)

πŸ“¦ version 1.0.25, in nixos 26.05, nixpkgs unstable

πŸ’… 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, main or nav tag β€” 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. 😌

  • -w WIDTH β€” 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