]> git.apps.os.sepia.ceph.com Git - fscrypt.git/commitdiff
Go formatter "gofmt" -> "goimports"
authorJoseph Richey <joerichey94@gmail.com>
Wed, 30 Aug 2017 05:29:33 +0000 (22:29 -0700)
committerJoseph Richey <joerichey94@gmail.com>
Wed, 30 Aug 2017 05:29:33 +0000 (22:29 -0700)
CONTRIBUTING.md
Makefile

index e7a2a75bdf0f3b4378202edec8a7b6463823ffd5..20fb884c5df623200fafa68c5c101ad310ad619e 100644 (file)
@@ -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
index 1ec009e928753655382e0d75d77b1fdcdf4cddc8..af1d4ab139757a79fadcc37b768d7c15a183a904 100644 (file)
--- 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 "<replacement " \
@@ -169,6 +169,7 @@ go-tools:
        go get -u github.com/golang/protobuf/protoc-gen-go
        go get -u github.com/golang/lint/golint
        go get -u github.com/kardianos/govendor
+       go get -u golang.org/x/tools/cmd/goimports
        go get -u honnef.co/go/tools/cmd/megacheck
 
 ##### Setup/Teardown for integration tests (need root permissions) #####