diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 481557bd..91871338 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,6 +34,25 @@ jobs: # with: # version: latest + format: + name: Go Format Check + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + cache: true + - name: Check Go formatting + run: | + if [ "$(gofmt -l . | wc -l)" -gt 0 ]; then + echo "The following files are not formatted correctly:" + gofmt -l . + echo "Please run 'gofmt -w .' (or configure your IDE to automatically run gofmt upon save) to fix formatting issues." + exit 1 + fi + generate: runs-on: ubuntu-latest steps: @@ -54,7 +73,7 @@ jobs: # Run acceptance tests in a matrix with Terraform CLI versions test: name: Terraform Provider Acceptance Tests - needs: build + needs: [build, format] runs-on: ubuntu-latest timeout-minutes: 15 strategy: