Note: When go-grpc-prometheus was in the main $gopath (even at this
version) and everyone else was where they always were in vendor/ this
didn't build! It gave errors like:
have SendHeader("github.com/purpleidea/mgmt/vendor/google.golang.org/grpc/metadata".MD) error
want SendHeader("google.golang.org/grpc/metadata".MD) error
and I got frustrated. Putting it "next" to the other vendored deps seems
to have fixed this. Where are the golang docs that explain this
phenomenon?
This also requires golang 1.8+ as that is a requirement for etcd. It's
probably a reasonable thing for us too.
Note the older versions of etcd had some bugs with the concurrency
package and other things, so this is a necessary bump.
31 lines
743 B
Bash
Executable File
31 lines
743 B
Bash
Executable File
#!/bin/bash
|
|
# original version of this script from kubernetes project, under ALv2 license
|
|
|
|
. test/util.sh
|
|
|
|
echo running test-gofmt.sh
|
|
set -o errexit
|
|
set -o nounset
|
|
set -o pipefail
|
|
|
|
ROOT=$(dirname "${BASH_SOURCE}")/..
|
|
|
|
#GO_VERSION=($(go version))
|
|
#
|
|
#if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.2|go1.3|go1.4|go1.5|go1.6|go1.7|go1.8|go1.9|devel') ]]; then
|
|
# fail_test "Unknown go version '${GO_VERSION[2]}', failing gofmt."
|
|
#fi
|
|
|
|
cd "${ROOT}"
|
|
|
|
find_files() {
|
|
git ls-files | grep '\.go$'
|
|
}
|
|
|
|
GOFMT="gofmt" # we prefer to not use the -s flag, which is pretty annoying...
|
|
bad_files=$(find_files | xargs $GOFMT -l)
|
|
if [[ -n "${bad_files}" ]]; then
|
|
fail_test "The following golang files are not properly formatted: ${bad_files}"
|
|
fi
|
|
echo 'PASS'
|