diff options
author | Jake <jake@gnu.space> | 2017-06-05 20:54:15 +0000 |
---|---|---|
committer | Jake <jake@gnu.space> | 2017-06-05 20:54:15 +0000 |
commit | 8904b9d035e113e0c052acfed35c4ab5a6d6973b (patch) | |
tree | 942866927d945dcbe16028d682d73758a871acea /scripts/errcheck.sh | |
download | terraform-provider-statuscake-8904b9d035e113e0c052acfed35c4ab5a6d6973b.tar.gz terraform-provider-statuscake-8904b9d035e113e0c052acfed35c4ab5a6d6973b.tar.zst terraform-provider-statuscake-8904b9d035e113e0c052acfed35c4ab5a6d6973b.zip |
initial commit
Diffstat (limited to 'scripts/errcheck.sh')
-rwxr-xr-x | scripts/errcheck.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/errcheck.sh b/scripts/errcheck.sh new file mode 100755 index 0000000..15464f5 --- /dev/null +++ b/scripts/errcheck.sh | |||
@@ -0,0 +1,24 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | # Check gofmt | ||
4 | echo "==> Checking for unchecked errors..." | ||
5 | |||
6 | if ! which errcheck > /dev/null; then | ||
7 | echo "==> Installing errcheck..." | ||
8 | go get -u github.com/kisielk/errcheck | ||
9 | fi | ||
10 | |||
11 | err_files=$(errcheck -ignoretests \ | ||
12 | -ignore 'github.com/hashicorp/terraform/helper/schema:Set' \ | ||
13 | -ignore 'bytes:.*' \ | ||
14 | -ignore 'io:Close|Write' \ | ||
15 | $(go list ./...| grep -v /vendor/)) | ||
16 | |||
17 | if [[ -n ${err_files} ]]; then | ||
18 | echo 'Unchecked errors found in the following places:' | ||
19 | echo "${err_files}" | ||
20 | echo "Please handle returned errors. You can check directly with \`make errcheck\`" | ||
21 | exit 1 | ||
22 | fi | ||
23 | |||
24 | exit 0 | ||