Skip to content

Commit

Permalink
s/gofmt/goimports/
Browse files Browse the repository at this point in the history
goimports is a superset of gofmt.  It does everything gofmt does, and
also organizes package imports.
  • Loading branch information
Eugene Kim committed Jan 25, 2019
1 parent dd214db commit 0755123
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Coding Guidelines

* In general, we follow [effective_go](https://golang.org/doc/effective_go.html)
* Code must adhere to the official [Go formatting guidelines](https://golang.org/doc/effective_go.html#formatting) (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)).
* Code must adhere to the official [Go formatting guidelines](https://golang.org/doc/effective_go.html#formatting) (i.e. uses [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports)).
* Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines.

## Pull Request (PR)
Expand All @@ -13,7 +13,7 @@ This [github document](https://help.github.com/articles/creating-a-pull-request/
## PR requirement
To pursue engineering excellence, we have insisted on the highest stardard on the quality of each PR.

* For each PR, please run [golint](https://github.com/golang/lint), [gofmt](https://golang.org/cmd/gofmt/), to fix the basic issues/warnings.
* For each PR, please run [golint](https://github.com/golang/lint), [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports), to fix the basic issues/warnings.
* Make sure you understand [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/).
* Add a [Test] section in every PR detailing on your test process and results. If the test log is too long, please include a link to [gist](https://gist.github.com/) and add the link to the PR.

Expand Down
16 changes: 8 additions & 8 deletions scripts/travis_checker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ print_file() {
echo "--- END ${2} ---"
}

unset -v ok tmpdir go_files go_dirs gofmt_output golint_output
unset -v ok tmpdir go_files go_dirs goimports_output golint_output
ok=true
tmpdir=
trap 'case "${tmpdir}" in ?*) rm -rf "${tmpdir}";; esac' EXIT
Expand Down Expand Up @@ -56,16 +56,16 @@ else
ok=false
fi

echo "Running gofmt..."
gofmt_output="${tmpdir}/gofmt_output.txt"
xargs gofmt -d -e < "${go_files}" > "${gofmt_output}" 2>&1
if [ -s "${gofmt_output}" ]
echo "Running goimports..."
goimports_output="${tmpdir}/goimports_output.txt"
xargs goimports -d -e < "${go_files}" > "${goimports_output}" 2>&1
if [ -s "${goimports_output}" ]
then
echo "gofmt FAILED!"
print_file "${gofmt_output}" "gofmt"
echo "goimports FAILED!"
print_file "${goimports_output}" "goimports"
ok=false
else
echo "gofmt passed."
echo "goimports passed."
fi

if ! ${ok}
Expand Down

0 comments on commit 0755123

Please sign in to comment.