Workflow #14
Workflow file for this run
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
name: Check Go Format | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
go-fmt-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' | |
- name: List files in the repository | |
run: ls -R | |
- name: Find Go files | |
run: find . -name "*.go" | |
- name: Run gofmt | |
run: | | |
GOFMT_OUTPUT=$(gofmt -l .) | |
if [ -n "$GOFMT_OUTPUT" ]; then | |
echo "以下Go文件格式不正确:" | |
echo "$GOFMT_OUTPUT" | |
exit 1 | |
else | |
echo "所有Go文件格式正确。" | |
fi |