chore: check go.mod and gofmt in CI #2232
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: Lint | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [opened, edited, synchronize, reopened] | |
jobs: | |
go-mod: | |
name: Check go.mod | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: Check go.mod | |
run: | | |
go mod tidy | |
git diff --exit-code go.mod | |
git diff --exit-code go.sum | |
gofmt: | |
name: Check unformatted Go code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: Run gofmt | |
run: | | |
find . -type f -name '*.go' -not -path './testdata/*' -exec gofmt -w {} + | |
git diff --exit-code | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Run Revive Action | |
uses: morphy2k/revive-action@v2 | |
with: | |
config: revive.toml | |
path: ./... |