/ website / blog

hclfmt as a service

March 28, 2020

As a developer working on Nomad, there is frequent need for copying and pasting snippets of HCL to and from GitHub issues, documentation, example files, etc. While the normal hclfmt command works great on files, it is not so convenient for web mediums. Pasted HCL snippets into issues and comments tend to be malformed.

Not anymore! sethops1.net/hclfmt is a simple HCL formatter for conveniently formatting those HCL snippets before pasting them into GitHub issues and the like. Under the hood it runs the hcl2 formatter as a library, so the output is guaranteed to be well formed. It does the same syntax validation the hclfmt command would do.

Happy hacking!

➡️ related posts in the go tools series ...