github.com/openshift/installer@v1.4.17/hack/go-fmt.sh (about)

     1  #!/bin/sh
     2  if [ "$IS_CONTAINER" != "" ]; then
     3    gci_repo=github.com/daixiang0/gci
     4    for TARGET in "${@}"; do
     5      find "${TARGET}" -name '*.go' ! -path '*/vendor/*' ! -path '*/.build/*' -exec gofmt -s -w {} \+
     6      find "${TARGET}" -name '*.go' ! -path '*/vendor/*' ! -path '*/.build/*' -exec go run "$gci_repo" write -s standard -s default -s "prefix(github.com/openshift)" -s blank --skip-generated {} \+
     7    done
     8    git diff --exit-code
     9  else
    10    podman run --rm \
    11      --env IS_CONTAINER=TRUE \
    12      --volume "${PWD}:/go/src/github.com/openshift/installer:z" \
    13      --workdir /go/src/github.com/openshift/installer \
    14      docker.io/golang:1.22 \
    15      ./hack/go-fmt.sh "${@}"
    16  fi