added linter

This commit is contained in:
Mike Schwörer 2023-06-14 15:03:37 +02:00
parent 22720169a2
commit fb826919a6
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 46 additions and 1 deletions

40
scnserver/.golangci.yml Normal file
View File

@ -0,0 +1,40 @@
# https://golangci-lint.run/usage/configuration/
run:
go: '1.20'
linters:
enable-all: true
disable:
- golint # deprecated
- exhaustivestruct # deprecated
- deadcode # deprecated
- scopelint # deprecated
- structcheck # deprecated
- varcheck # deprecated
- nosnakecase # deprecated
- maligned # deprecated
- interfacer # deprecated
- ifshort # deprecated
- dupl # (i disagree)
- ireturn # (i disagree)
- wrapcheck # (waiting for bferr)
- goerr113 # (waiting for bferr)
- varnamelen # (too many false-positives)
- gomnd # (i disagree)
- depguard # (not configured)
- gofumpt # (we do not use gofumpt)
- gci # (we do no use gci)
- lll # (i disagree)
- gochecknoglobals # (i disagree)
issues:
exclude-rules:
- path: api/handler/.*.go
linters:
- funlen
linters-settings:
tagalign:
align: true
sort: false

View File

@ -5,7 +5,7 @@ PORT=9090
NAMESPACE=$(shell git rev-parse --abbrev-ref HEAD) NAMESPACE=$(shell git rev-parse --abbrev-ref HEAD)
HASH=$(shell git rev-parse HEAD) HASH=$(shell git rev-parse HEAD)
.PHONY: test swagger pygmentize docker .PHONY: test swagger pygmentize docker migrate dgi pygmentize lint
build: swagger pygmentize fmt build: swagger pygmentize fmt
mkdir -p _build mkdir -p _build
@ -91,3 +91,8 @@ migrate:
CGO_ENABLED=1 go build -v -o _build/scn_migrate -tags "timetzdata sqlite_fts5 sqlite_foreign_keys" ./cmd/migrate CGO_ENABLED=1 go build -v -o _build/scn_migrate -tags "timetzdata sqlite_fts5 sqlite_foreign_keys" ./cmd/migrate
./_build/scn_migrate ./_build/scn_migrate
lint:
# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.53.2
golangci-lint run ./...