Skip to content

Commit

Permalink
Merge pull request #368 from Danil-Grigorev/add-generate-task
Browse files Browse the repository at this point in the history
[OCPCLOUD-809] Add verify-diff check in generate task and enable in CI
  • Loading branch information
openshift-merge-robot committed Nov 6, 2020
2 parents 05b5459 + 3d2dd98 commit bc5addc
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ vendor:
go mod verify

.PHONY: generate
generate:
generate: gogen goimports

gogen:
$(DOCKER_CMD) go generate ./pkg/... ./cmd/...
hack/goimports.sh .

.PHONY: test
test: ## Run tests
Expand Down Expand Up @@ -103,8 +104,9 @@ fmt: ## Go fmt your code
hack/go-fmt.sh .

.PHONY: goimports
goimports: ## Go fmt your code
goimports:
hack/goimports.sh .
hack/verify-diff.sh

.PHONY: vet
vet: ## Apply go vet to all go files
Expand Down
1 change: 0 additions & 1 deletion hack/goimports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ if [ "$IS_CONTAINER" != "" ]; then
for TARGET in "${@}"; do
find "${TARGET}" -name '*.go' ! -path '*/vendor/*' ! -path '*/.build/*' -exec goimports -w {} \+
done
git diff --exit-code
else
docker run -it --rm \
--env IS_CONTAINER=TRUE \
Expand Down
9 changes: 9 additions & 0 deletions hack/verify-diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FILE_DIFF=$(git ls-files -o --exclude-standard)

if [ "$FILE_DIFF" != "" ]; then
echo "Found untracked files:"
echo $FILE_DIFF
exit 1
fi

git diff --exit-code
25 changes: 25 additions & 0 deletions pkg/apis/awsprovider/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bc5addc

Please sign in to comment.