diff --git a/hack/go-fmt.sh b/hack/go-fmt.sh new file mode 100755 index 00000000000..82e349a0b05 --- /dev/null +++ b/hack/go-fmt.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# Example: ./hack/go-lint.sh installer/... tests/smoke + +if [ "$IS_CONTAINER" != "" ]; then + for TARGET in "${@}"; do + find "${TARGET}" -name '*.go' ! -path '*/vendor/*' ! -path '*/.build/*' -exec gofmt -s -w {} \+ + done + git diff --exit-code +else + docker run --rm \ + --env IS_CONTAINER=TRUE \ + --volume "${PWD}:/go/src/github.com/openshift/installer:z" \ + --workdir /go/src/github.com/openshift/installer \ + --entrypoint sh \ + quay.io/coreos/golang-testing \ + ./hack/go-fmt.sh "${@}" +fi