From 8539c4c12ebdd6441f5d93fd499e31df2ed943c3 Mon Sep 17 00:00:00 2001 From: Joseph Richey Date: Tue, 29 Aug 2017 22:29:33 -0700 Subject: [PATCH] Go formatter "gofmt" -> "goimports" --- CONTRIBUTING.md | 9 +++++---- Makefile | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e7a2a75..20fb884 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -86,10 +86,11 @@ make test-teardown ### Formatting and Linting -The `make format` command formats all the code in fscrypt with either `gofmt` -(for Go code) or [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html) -(for C code). `gofmt` comes with any Go distribution, and `clang-format` can be -installed with your package manager. +The `make format` command formats all the code in fscrypt with either +[`goimports`](https://godoc.org/golang.org/x/tools/cmd/goimports) (for Go code) +or [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html) (for C code). +`goimports` can be installed with `go get`; `clang-format` can be installed +with your package manager. The `make lint` command runs a series of static analysis checks on your code. This requires the diff --git a/Makefile b/Makefile index 1ec009e..af1d4ab 100644 --- a/Makefile +++ b/Makefile @@ -129,11 +129,11 @@ update: # Format all the Go and C code .PHONY: format format-check format: - @gofmt -l -s -w $(GO_FILES) + @goimports -l -w $(GO_FILES) @clang-format -i -style=Google $(C_FILES) format-check: - @gofmt -s -d $(GO_FILES) \ + @goimports -d $(GO_FILES) \ | ./input_fail.py "Incorrectly formatted Go files. Run \"make format\"." @clang-format -i -style=Google -output-replacements-xml $(C_FILES) \ | grep "