Skip to content

Ghi070 reuse reflect #45

Ghi070 reuse reflect

Ghi070 reuse reflect #45

Workflow file for this run

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