Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Fix codecheck.sh to fail if the script itself fails #1249

Merged
merged 1 commit into from
Oct 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions codecheck.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
#!/bin/bash

# Fail fast on errors
set -e

# Download the fgt tool which returns a non-zero value if a command prints anything to stdout
# And grab coverage / lint tools
go get \
github.com/GeertJohan/fgt \
github.com/golang/lint/golint \
golang.org/x/tools/cmd/cover


export BASE_PATH=$(cd $(dirname $0); pwd -P)

# The value of the exit status for the script.
Expand All @@ -18,21 +29,16 @@ function testCmd() {
# This will set the return to non zero if output is returned. useful for go fmt.
# uses fgt instead of eval
function testCmdOutput() {
set +e
fgt "$@"
ret=$?
set -e
if (($ret > 0)); then
scriptreturn=$ret
echo "FAILURE: $@"
fi
}

# Download the fgt tool which returns a non-zero value if a command prints anything to stdout
go get github.com/GeertJohan/fgt
go install github.com/GeertJohan/fgt

# Golint install
go get -u github.com/golang/lint/golint

# Get the list of packages.
pkgs=`glide novendor -x`

Expand Down Expand Up @@ -70,7 +76,6 @@ do
done

# Coverage Check
go get golang.org/x/tools/cmd/cover
echo
echo
echo '---------------------------------------------------------'
Expand Down