Debian Codegraph @

scripts/check_fmt

raw
1 #!/bin/bash
2 # Checks that all Go files in the specified project respect gofmt formatting.
3 # Requires GOPATH to be set to a single path, not a list of them.
4 PROJECT=${1:?missing project}
5 PROBLEMS=
6 for pkg in $(go list ${PROJECT}/...) ; do
7 NONCOMPLIANT=$(gofmt -l ${GOPATH}/src/${pkg}/*.go)
8 if [ -n "${NONCOMPLIANT}" ]; then
9 echo pkg $pkg has some gofmt non-compliant files:
10 echo ${NONCOMPLIANT}|xargs -d ' ' -n1 basename
11 PROBLEMS="y"
12 fi
13 done
14 test -z "${PROBLEMS}"