Skip to content

Commit

Permalink
Make pre-commit hook do the formatting; request use in README
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Fuchs committed Feb 25, 2017
1 parent aee372b commit 55721d6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"

fmt:
@echo "Running source files through gofmt..."
gofmt -w $(GOFMT_FILES)

install-pre-commit-hook:
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,8 @@ Here is how the `errors` package should be used:

#### Formatting

Every source file in this project should be formatted with `go fmt`. Feel free to accomplish this any way you choose. There are also few helper scripts and targets in the Makefile that can help with this (mostly taken from the [terraform repo](https://github.com/hashicorp/terraform/)):
Every source file in this project should be formatted with `go fmt`. There are few helper scripts and targets in the
Makefile that can help with this (mostly taken from the [terraform repo](https://github.com/hashicorp/terraform/)):

1. `make fmtcheck`

Expand All @@ -1091,8 +1092,10 @@ Every source file in this project should be formatted with `go fmt`. Feel free t
Formats all source files with `gofmt`.
1. `make install-pre-commit-hook`

Installs a git pre-commit hook that will check if all source files are formatted, and block the commit if not.

Installs a git pre-commit hook that will run all of the source files through `gofmt`.

To ensure that your changes get properly formatted, please install the git pre-commit hook with `make install-pre-commit-hook`.

#### Releasing new versions

To release a new version, just go to the [Releases Page](https://github.com/gruntwork-io/terragrunt/releases) and
Expand Down
2 changes: 1 addition & 1 deletion scripts/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
make fmtcheck
make fmt

0 comments on commit 55721d6

Please sign in to comment.