Skip to content

style: apply lint

style: apply lint #1

Workflow file for this run

name: Lint
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
env:
GO_VERSION: "1.24"
jobs:
lint:
name: Lint Code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: go.sum
- name: Cache Go build cache
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go${{ env.GO_VERSION }}-build-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-go${{ env.GO_VERSION }}-build-
${{ runner.os }}-go-build-
- name: Cache golangci-lint
uses: actions/cache@v4
with:
path: ~/.cache/golangci-lint
key: ${{ runner.os }}-golangci-lint-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golangci-lint-
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
args: --timeout=5m
cache: true
- name: Check formatting
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
echo "Code is not formatted. Run 'gofmt -s -w .'"
gofmt -s -d .
exit 1
fi
- name: Run go vet
run: go vet ./...
- name: Verify dependencies
run: go mod verify
- name: Check for unused dependencies
run: |
go mod tidy
if [ -n "$(git status --porcelain go.mod go.sum)" ]; then
echo "go.mod or go.sum is not up to date. Run 'go mod tidy'"
git diff go.mod go.sum
exit 1
fi