opentofu/scripts/errcheck.sh
Clint 740b8bb9cb provider/aws: Run errcheck in tests (#8579)
* provider/aws: Add errcheck to Makefile, error on unchecked errors

* more exceptions

* updates for errcheck to pass

* reformat and spilt out the ignore statements

* narrow down ignores

* fix typo, only ignore Close and Write, instead of close or write
2016-09-02 09:24:17 -05:00

26 lines
703 B
Bash
Executable File

#!/usr/bin/env bash
# Check gofmt
echo "==> Checking AWS provider for unchecked errors..."
echo "==> NOTE: at this time we only look for uncheck errors in the AWS package"
if ! which errcheck > /dev/null; then
echo "==> Installing errcheck..."
go get -u github.com/kisielk/errcheck
fi
err_files=$(errcheck -ignoretests -ignore \
'github.com/hashicorp/terraform/helper/schema:Set' \
-ignore 'bytes:.*' \
-ignore 'io:Close|Write' \
./builtin/providers/aws/...)
if [[ -n ${err_files} ]]; then
echo 'Unchecked errors found in the following places:'
echo "${err_files}"
echo "Please handle returned errors. You can check directly with \`make errcheck\`"
exit 1
fi
exit 0