google/yamlfmt

Yamlfmt is too big as pre-commit hook

Closed this issue · 2 comments

I'm using yaml format as a hook in pre-commit tool, but it's biggest in our docker container - 243Mb! And almost all 243Mb is folder golangenv-default
Its biggest pre-commit hook I've used with my Python code
Second largest hook only 80Mb

I don't know much about pre-commit, but my guess is that it's because language: golang ends up downloading the entire Go language to be able to build the program on your machine to then run as a hook. One thing I'm not sure about is whether this is circumvented if Go is already installed locally; it would make sense to me if having a local version of Go meant that pre-commit would just use that instead of downloading it as part of the hook.

The other option is to download a version of yamlfmt from the GitHub Releases and use that local binary. The yamlfmt binary is only 3.1 Mb itself, and if you go this route then I don't think pre-commit has to download anything. Here are the instructions to do that: https://github.com/google/yamlfmt/releases/download/v0.13.0/yamlfmt_0.13.0_Linux_x86_64.tar.gz

I don't know if there's anything I can substantially do on the yamlfmt side to assuage this, so I'll close this issue. Hopefully the info helps.

Ok, thanks. I would think about that