2015-12-17 11:21:43 -06:00
|
|
|
#!/usr/bin/env bash
|
2023-05-02 10:33:06 -05:00
|
|
|
# Copyright (c) HashiCorp, Inc.
|
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2015-12-17 11:21:43 -06:00
|
|
|
|
2020-12-02 11:02:33 -06:00
|
|
|
# Check go fmt
|
|
|
|
echo "==> Checking that code complies with go fmt requirements..."
|
|
|
|
gofmt_files=$(go fmt ./...)
|
2015-12-17 11:21:43 -06:00
|
|
|
if [[ -n ${gofmt_files} ]]; then
|
|
|
|
echo 'gofmt needs running on the following files:'
|
|
|
|
echo "${gofmt_files}"
|
2020-12-02 11:02:33 -06:00
|
|
|
echo "You can use the command: \`go fmt\` to reformat code."
|
2015-12-17 11:21:43 -06:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|