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

Commit

Permalink
Merge pull request #1249 from govau/fixci
Browse files Browse the repository at this point in the history
Fix codecheck.sh to fail if the script itself fails
  • Loading branch information
jcscottiii authored Oct 5, 2017
2 parents d010439 + 56cae6f commit af47a6f
Showing 1 changed file with 13 additions and 8 deletions.
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

0 comments on commit af47a6f

Please sign in to comment.