Merge pull request #47 from prime-run/fix-write-bug #8
This file contains hidden or 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: Format | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| jobs: | |
| format: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24.1' | |
| - name: Check gofmt | |
| run: | | |
| if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then | |
| echo "The following files are not formatted:" | |
| gofmt -s -l . | |
| echo "Please run 'gofmt -s -w .' to fix formatting issues." | |
| exit 1 | |
| fi | |
| - name: Check goimports | |
| run: | | |
| go install golang.org/x/tools/cmd/goimports@latest | |
| if [ "$(goimports -l . | wc -l)" -gt 0 ]; then | |
| echo "The following files have import issues:" | |
| goimports -l . | |
| echo "" | |
| echo "To fix these import issues, run:" | |
| echo "goimports -w ." | |
| exit 1 | |
| fi |