From ba230c70a27dc77f73fdc39d0e804db5c18f0705 Mon Sep 17 00:00:00 2001 From: Dominik Date: Fri, 5 Jun 2026 13:29:58 +0200 Subject: [PATCH] feat(languages): go fmt pipeline --- .github/workflows/languages-go-fmt.yml | 52 ++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/languages-go-fmt.yml diff --git a/.github/workflows/languages-go-fmt.yml b/.github/workflows/languages-go-fmt.yml new file mode 100644 index 0000000..6b0915a --- /dev/null +++ b/.github/workflows/languages-go-fmt.yml @@ -0,0 +1,52 @@ +name: Go Format + +on: + workflow_call: + inputs: + go-version-file: + description: "Path to go.mod for version resolution" + type: string + default: "go.mod" + run-vet: + description: "Also run go vet" + type: boolean + default: true + +jobs: + fmt: + name: gofmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: ${{ inputs.go-version-file }} + cache: true + + - name: Check formatting + run: | + unformatted=$(gofmt -l .) + if [ -n "$unformatted" ]; then + echo "::error::The following files are not gofmt-formatted:" + echo "$unformatted" + echo "" + echo "Run: gofmt -w ." + exit 1 + fi + + vet: + name: go vet + runs-on: ubuntu-latest + needs: fmt + if: ${{ inputs.run-vet }} + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: ${{ inputs.go-version-file }} + cache: true + + - name: go vet + run: go vet ./...