-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e021533
commit 6808c72
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |