1
0
mirror of https://github.com/openshift/source-to-image.git synced 2026-02-05 12:44:54 +01:00
Files
source-to-image/hack/verify-gofmt.sh
Rodolfo Carvalho cf1d83d612 Fix hack/verify-*.sh and improve other scripts
Summary:
- Add 'make verify' to Travis.
- Fix verify-golint.sh: old invocation would not work unless GOPATH is a
  single directory.
- Fix verify-govet.go: 'go vet' does not take flags, should use 'go tool
  vet'.
- Fix early termination of hack/verify-govet.sh.
- Enable 'go vet' in 'make verify'; will prevent introducing problems
  detected by the vet tool in future PRs.
- Make sure golint is installed in Travis.
- Improve install-tools.sh, parity with the one in openshift/origin.
- s/os::util::sed/s2i::util::sed for consistency.
- Reimplement/simplify find_files, now called s2i::util::find_files, and
  use it in all scripts consistently.
- Suggest autocorrection for gofmt, as seen in openshift/origin.
- Do not check Go version (verify-*.sh should be run no matter the Go
  version?!).
- Do not create directory _output/govet (not used?!).
- Explicitly disable check of composite literals. Vet gives false
  positives on literals using unkeyed fields.
2016-05-19 14:42:56 +02:00

22 lines
486 B
Bash
Executable File

#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
echo $(go version)
S2I_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${S2I_ROOT}/hack/util.sh"
cd "${S2I_ROOT}"
bad_files=$(s2i::util::find_files | xargs gofmt -s -l)
if [[ -n "${bad_files}" ]]; then
echo "!!! gofmt needs to be run on the following files: " >&2
echo "${bad_files}"
echo "Try running 'gofmt -s -d [path]'" >&2
echo "Or autocorrect with 'hack/verify-gofmt.sh | xargs -n 1 gofmt -s -w'" >&2
exit 1
fi