Skip to content

Commit

Permalink
Add golangci-lint for static check.
Browse files Browse the repository at this point in the history
  • Loading branch information
zzheng2020 committed Apr 13, 2024
1 parent 42e9213 commit 156585b
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Golangci Lint

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

permissions:
contents: read
pull-requests: read
checks: write

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v3
with:
go-version: "1.21.1"

- run: |
make gen-proto
gen-swagger
- name: Run golangci-lint
uses: golangci/[email protected]
51 changes: 51 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
linters-settings:
govet:
enable-all: true

gocyclo:
min-complexity: 20

goconst:
min-len: 3
min-occurrences: 3

misspell:
locale: US

lll:
line-length: 120

unused:
check-exported: true

unparam:
check-exported: true

linters:
enable:
- bodyclose
- errcheck
- gocognit
- goconst
- gocyclo
- gofmt
- goimports
- revive
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- staticcheck
- typecheck
- unconvert
- unparam
- unused

issues:
new-from-rev: ""
exclude-generated-strict: true


run:
deadline: 5m

0 comments on commit 156585b

Please sign in to comment.