Skip to content

Commit

Permalink
ci: add gofmt check to test-agent workflow (#928)
Browse files Browse the repository at this point in the history
Add gofmt check to test-agent workflow which will check pull request for
daemon's code formatting deviations from go code formatting standards.
  • Loading branch information
lavarou committed Jun 28, 2024
1 parent 7d43f5f commit b53fdb7
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/test-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,31 @@ on:
pull_request:

jobs:
gofmt-check:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout newrelic-php-agent code
uses: actions/checkout@v4
with:
path: php-agent
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: ./php-agent/daemon/go.mod
cache: false
- name: Display go version
run: |
go version
- name: Run gofmt
run: |
GOFMT_REPORTED_FILES="$(gofmt -l -e ./php-agent/daemon)"
if [ ! -z "$GOFMT_REPORTED_FILES" ]; then
gofmt -d -e ./php-agent/daemon
echo "### gofmt violations found in $(echo "$GOFMT_REPORTED_FILES" | wc -l) files" >> $GITHUB_STEP_SUMMARY
echo "$GOFMT_REPORTED_FILES" >> $GITHUB_STEP_SUMMARY
exit 1
fi
daemon-unit-tests:
runs-on: ubuntu-latest
env:
Expand Down

0 comments on commit b53fdb7

Please sign in to comment.