forked from kubernetes/autoscaler
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UPSTREAM: <carry>: openshift: Extend makefile with 'make goimports' t…
…arget So the target can be run in CI and fail in case files are not properly goimport formated.
- Loading branch information
1 parent
8e8c4d4
commit 8d95ce2
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
|
||
REPO_NAME=$(basename "${PWD}") | ||
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 \ | ||
--volume "${PWD}:/go/src/sigs.k8s.io/${REPO_NAME}:z" \ | ||
--workdir "/go/src/sigs.k8s.io/${REPO_NAME}" \ | ||
openshift/origin-release:golang-1.12 \ | ||
./hack/goimports.sh "${@}" | ||
fi |