Skip to content

Migrate golanci-lint to v2 #354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
go-version: '1.24.1'

- name: Install golangci-lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.7
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.0.2

- name: Build
run: go build -v ./...
Expand Down
113 changes: 52 additions & 61 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,23 @@
# https://golangci-lint.run/usage/quick-start/
run:
timeout: 1m
build-tags:
version: "2"
linters:
# https://golangci-lint.run/usage/linters/

enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
- asasalint
- asciicheck
- bidichk
#- bodyclose
- canonicalheader
- containedctx
- contextcheck
- copyloopvar
- cyclop
- decorder
#- depguard
- dogsled
- durationcheck
#- dupword
- errchkjson
- err113
- errchkjson
- errname
- errorlint
- exhaustive
- fatcontext
#- forbidigo
#- forcetypeassert
- gci
- ginkgolinter
- gocheckcompilerdirectives
- gochecksumtype
Expand All @@ -45,34 +27,24 @@ linters:
- gocyclo
- godot
- godox
- err113
- gofmt
- gofumpt
- goheader
- goimports
- gomoddirectives
- gomodguard
#- goprintffuncname
#- gosec
- gosmopolitan
- grouper
- importas
- interfacebloat
- intrange
#- lll
- loggercheck
- makezero
- mirror
- misspell
#- mnd
- musttag
- nakedret
#- nestif
- nilerr
- nilnesserr
- nilnil
- nlreturn
#- noctx
- nolintlint
- nonamedreturns
- perfsprint
Expand All @@ -86,45 +58,64 @@ linters:
- rowserrcheck
- sloglint
- spancheck
- stylecheck
- sqlclosecheck
- stylecheck
- staticcheck
- tagalign
- tagliatelle
- testifylint
- unconvert
- unparam
- usestdlibvars
#- varnamelen
- wastedassign
- whitespace
- wrapcheck
- zerologlint

linters-settings:
cyclop:
max-complexity: 25
issues:
exclude-rules:
- path: c2/sslshell/sslshellserver.go
linters:
- staticcheck
text: SA1019
- path: c2/httpservefile/httpservefile.go
linters:
- staticcheck
text: SA1019
- path: httphelper.go
linters:
- staticcheck
text: SA1019
- path: c2/shelltunnel/shelltunnel.go
linters:
- staticcheck
text: SA1019
- path: cli/commandline_test.go
linters:
- staticcheck
text: SA1019
exclude-files:
- protocol/mikrotik/msg.go
settings:
cyclop:
max-complexity: 25
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- staticcheck
path: c2/sslshell/sslshellserver.go
text: SA1019
- linters:
- staticcheck
path: c2/httpservefile/httpservefile.go
text: SA1019
- linters:
- staticcheck
path: httphelper.go
text: SA1019
- linters:
- staticcheck
path: c2/shelltunnel/shelltunnel.go
text: SA1019
- linters:
- staticcheck
path: cli/commandline_test.go
text: SA1019
paths:
- protocol/mikrotik/msg.go
- third_party$
- builtin$
- examples$
formatters:
enable:
- gci
- gofmt
- gofumpt
- goimports
exclusions:
generated: lax
paths:
- protocol/mikrotik/msg.go
- third_party$
- builtin$
- examples$