Ghi070 reuse reflect #45
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: gofmt | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
check-code-format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Run gofmt | |
run: gofmt -l . > gofmt_report.txt | |
- name: Check gofmt output | |
run: | | |
report="$(head -n 1 gofmt_report.txt)" | |
if [ -n "$report" ]; then | |
echo "gofmt -l ." 1>&2 | |
cat gofmt_report.txt | |
echo "FAILED: gofmt would cause changes." 1>&2 | |
echo "Run 'gofmt -w .' on codebase and try again." 1>&2 | |
exit 1 | |
else | |
echo "PASS: Code conforms to gofmt formatting conventions." | |
fi |