Skip to content

Commit

Permalink
Use goimports instead of gofmt
Browse files Browse the repository at this point in the history
Everything except imports should be the same like with a direct call of
gofmt.

Imports will now be grouped into system packages, vendor packages and
kubevirt packages when calling "make fmt".
  • Loading branch information
rmohr authored and stu-gott committed May 17, 2017
1 parent 0a87707 commit 3668bad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@ install:
- git reset --hard # we are caching the vendor folder, make sure we see the new vendor.json file
- go get github.com/mattn/goveralls
- go get -u github.com/kardianos/govendor
- go get golang.org/x/tools/cmd/goimports
- go get -u github.com/golang/mock/gomock
- go get -u github.com/rmohr/mock/mockgen
- go get -u github.com/rmohr/go-swagger-utils/swagger-doc
- sudo apt-get install libvirt-dev make
- make sync

script:
- make fmt
- if git diff --name-only | grep '.*.go'; then echo "It seems like you did not run `make fmt`. Please run it and commit the changes"; false; fi
- make generate
- make fmt
- if git diff --name-only | grep 'generated.*.go'; then echo "Content of generated files changed. Please regenerate and commit them."; false; fi
- if diff <(git grep -c '') <(git grep -cI '') | grep -v 'swagger-ui' | grep '^<'; then echo "Binary files are present in git repostory."; false; fi
- make check
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ vet:
./hack/build-go.sh vet ${WHAT}

fmt:
./hack/build-go.sh fmt ${WHAT}
goimports -w -local kubevirt.io cmd/ pkg/ tests/

test: build
./hack/build-go.sh test ${WHAT}
Expand Down
4 changes: 3 additions & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ to install a few build requirements:


cd $GOPATH
# First we setup govendor which is used to track dependencies
# Use goimports for package import ordering
go get golang.org/x/tools/cmd/goimports
# Setup govendor which is used to track dependencies
go get -u github.com/kardianos/govendor
```

Expand Down

0 comments on commit 3668bad

Please sign in to comment.