Skip to content

Commit

Permalink
feat: add go format check
Browse files Browse the repository at this point in the history
  • Loading branch information
Norton-Lin committed Nov 18, 2024
1 parent e021533 commit 6808c72
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/go_fmt_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Go Format Check

on:
push:
branches:
- "**" # 监听所有分支的 push
pull_request: # 针对所有 PR
branches:
- "**"
workflow_dispatch: # 手动触发 workflow

jobs:
go-format-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.20" # 使用稳定的 Go 版本

- name: Check Go formatting
run: |
go fmt ./...
git diff --exit-code || (echo "❌ Go files are not properly formatted. Run 'go fmt' locally to fix." && exit 1)

0 comments on commit 6808c72

Please sign in to comment.