github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/script/format (about)

     1  #!/usr/bin/env bash
     2  
     3  goimports="goimports"
     4  
     5  find_files() {
     6    find . -not \( \
     7        \( \
     8          -wholename './output' \
     9          -o -wholename './_output' \
    10          -o -wholename './_gopath' \
    11          -o -wholename './release' \
    12          -o -wholename './target' \
    13          -o -wholename '*/third_party/*' \
    14          -o -wholename '*/vendor/*' \
    15        \) -prune \
    16      \) -name '*.go'
    17  }
    18  
    19  diff=$(find_files | xargs ${goimports} -d -e 2>&1)
    20  if [[ -n "${diff}" ]]; then
    21    echo "${diff}"
    22    exit 1
    23  fi