Add linting github action (#107)
* Add golangci config * Add lint action
This commit is contained in:
19
.github/workflows/lint.yml
vendored
Normal file
19
.github/workflows/lint.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
name: lint code
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Set git to use LF
|
||||||
|
run: git config --global core.autocrlf false
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: 1.22.x
|
||||||
|
- name: golangci-lint
|
||||||
|
uses: golangci/golangci-lint-action@v6
|
||||||
|
with:
|
||||||
|
version: v1.59
|
||||||
|
only-new-issues: true
|
||||||
36
.golangci.yaml
Normal file
36
.golangci.yaml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
run:
|
||||||
|
timeout: 5m
|
||||||
|
go: "1.22"
|
||||||
|
|
||||||
|
linters-settings:
|
||||||
|
gocritic:
|
||||||
|
enabled-tags:
|
||||||
|
- performance
|
||||||
|
lll:
|
||||||
|
line-length: 200
|
||||||
|
|
||||||
|
misspell:
|
||||||
|
locale: US
|
||||||
|
|
||||||
|
linters:
|
||||||
|
disable-all: true
|
||||||
|
enable:
|
||||||
|
- errcheck
|
||||||
|
- forcetypeassert
|
||||||
|
- gocritic
|
||||||
|
- goconst
|
||||||
|
- godot
|
||||||
|
- gofmt
|
||||||
|
- gofumpt
|
||||||
|
- goimports
|
||||||
|
- gosec
|
||||||
|
- gosimple
|
||||||
|
- govet
|
||||||
|
- importas
|
||||||
|
- ineffassign
|
||||||
|
- misspell
|
||||||
|
- revive # replacement for golint
|
||||||
|
- staticcheck
|
||||||
|
- typecheck
|
||||||
|
- unused
|
||||||
|
- whitespace
|
||||||
Reference in New Issue
Block a user