Add linting github action (#107)

* Add golangci config

* Add lint action
This commit is contained in:
Jonny Stoten
2024-07-31 14:42:19 +01:00
committed by GitHub
parent 9571f17476
commit fbe9a0c726
2 changed files with 55 additions and 0 deletions

19
.github/workflows/lint.yml vendored Normal file
View 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
View 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