Skip to content

Commit

Permalink
improve code checking
Browse files Browse the repository at this point in the history
Use goimports to check code:
goimports checks what gofmt does plus it keeps imports in specific
order. In this patch we:
- replace gofmt with goimports
- add code format checking to travis
- reorganize Makefile a little bit
- remove make generate-manifests from README.md since it is not needed
  during the development process
- add Makefile target for operator-sdk build k8s

Add whitespace check and auto-formatting:
I hate trailing whitespaces. This patch adds automated check detecting
any and Makefile target removing them.

Add codegen validation:
Add a check validating that generated code is up to date. This would
fail on travis in case a contributor forget to run `make generate-api`.

ship and goimports operator-sdk in vendor/:
In order to make sure everyone uses the same version of operator-sdk
producing the same code, let's keep operator-sdk in vendoring. The
same for goimports.

Signed-off-by: Petr Horacek <phoracek@redhat.com>
  • Loading branch information
phoracek committed Jun 5, 2019
1 parent fb91be6 commit 793e629
Show file tree
Hide file tree
Showing 12 changed files with 1,181 additions and 202 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Expand Up @@ -12,3 +12,12 @@ cluster/.kubectl

# Cover file
cover.out

# Makefile fake targets
gen-k8s
gen-k8s-check
goimports
goimports-check
vet
whitespace
whitespace-check
6 changes: 3 additions & 3 deletions .travis.yml
@@ -1,12 +1,12 @@
language: go
go: "1.10"
go: "1.11"

services:
- docker

install: true
script:
- make test
- make check
- make docker-build

deploy:
Expand All @@ -16,7 +16,7 @@ deploy:
on:
branch: master
- provider: script
script: docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" quay.io && make docker-build docker-push IMAGE_TAG=$TRAVIS_TAG
script: docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" quay.io && make docker-build docker-push IMAGE_TAG=$TRAVIS_TAG
skip_cleanup: true
on:
tags: true

0 comments on commit 793e629

Please sign in to comment.