From 5bc0982c5998165a41ee95707fe1b4daa5e531d7 Mon Sep 17 00:00:00 2001 From: tytv2 Date: Tue, 7 Jul 2026 09:51:25 +0700 Subject: [PATCH] ci: add a gofmt + go vet lint gate to Run Tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a lightweight `lint` job (gofmt formatting check + go vet) to run-tests.yml so style/vet regressions are caught on every PR. Both already pass repo-wide; this is the conservative first lint gate — a fuller golangci-lint can follow once the team triages its findings. --- .github/workflows/run-tests.yml | 21 +++++++++++++++++++++ docs/development/release.md | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 3fb50cf..4837086 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -8,6 +8,27 @@ on: branches: [main, develop] jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: '1.22' + - name: gofmt + working-directory: go + run: | + unformatted=$(gofmt -l .) + if [ -n "$unformatted" ]; then + echo "These files are not gofmt-formatted:" + echo "$unformatted" + echo "Run: gofmt -w ." + exit 1 + fi + - name: go vet + working-directory: go + run: go vet ./... + build: runs-on: ${{ matrix.os }} strategy: diff --git a/docs/development/release.md b/docs/development/release.md index 21e2ad8..ca7e7db 100644 --- a/docs/development/release.md +++ b/docs/development/release.md @@ -38,7 +38,7 @@ Prefer the release-please flow for normal releases. | Workflow | Trigger | Purpose | |----------|---------|---------| -| `run-tests.yml` | PR + push | Build + test Go binary | +| `run-tests.yml` | PR | Lint (gofmt + go vet), build, and test the Go binary | | `pr-title.yml` | PR opened/edited | Enforce Conventional Commits PR title | | `release-please.yml` | Push to `main` | Maintain the release PR; on merge, tag + release + build binaries | | `release.yml` | Tag push `v*`, dispatch, or called by release-please | Build multi-platform binaries + attach to the release |