Build the tool:
go install or bazel build //buildifiergo get -d -u github.com/bazelbuild/buildifier/buildifier && go generate github.com/bazelbuild/buildifier/core && go install github.com/bazelbuild/buildifier/buildifier
Note: the extra ‘generate’ step as ‘go get’ does not run ‘generate’ when installing.
Use buildifier to create standardized formatting for BUILD files in the same way that clang-format is used for source files.