This post is Day 24 of Go Advent Calendar 2021(jp). ππ
golangci-lint is easy to use a very large of linters with a configuration file. On the other hand, it depends on a lot of linters, which makes it difficult to incorporate the latest implementations of them. Also, many of them have not been updated for some time. In such a situation, Go could introduce Generics at any moment. So I checked whether the linters support Generics or not, and summarized the results in the following list. In order to check if each linter supports or is going to support Generics, I search the issues and pull requests from the last 6 months using the keywords "generics", "type" and "1.18".
Name | Status | Remark |
---|---|---|
deadcode | β¬ | no update for 5 years |
errcheck | β¬ | - |
gosimple | β¬ | - |
govet | β | https://tip.golang.org/doc/go1.18#vet |
ineffassign | β¬ | - |
staticcheck | β¬ | issue exists but not yet supported |
structcheck | β¬ | no update for 3 yearsοΌReference to the package changed from GitHub to GitLab.οΌ |
typecheck | β¬ | - |
unused | β¬ | - |
varcheck | β¬ | same as structcheck |
asciicheck | β¬ | - |
bidichk | β¬ | - |
bodyclose | β¬ | - |
contextcheck | β¬ | - |
cyclop | β¬ | - |
depguard | β¬ | - |
dogsled | β¬ | - |
dupl | β¬ | - |
durationcheck | β¬ | - |
errchkjson | β¬ | - |
errname | β¬ | - |
errorlint | β¬ | - |
exhaustive | β¬ | There is no indication of how it will be implemented, but there is an issue that talks about the need to update it. |
exhaustivestruct | β¬ | - |
exportloopref | β¬ | - |
forbidigo | β¬ | - |
forcetypeassert | β¬ | - |
funlen | β¬ | no update for a year |
gci | β¬ | - |
gochecknoglobals | β¬ | - |
gochecknoinits | β¬ | - |
gocognit | β¬ | - |
goconst | β¬ | - |
gocritic | β¬ | Previously fixed error is recurring. |
gocyclo | β¬ | - |
godot | β¬ | - |
godox | β¬ | issue tab is hidden |
goerr113 | β¬ | - |
gofmt | β | Referencing standard packages via golangci/gofmt, so some may not be supported. |
gofumpt | β | https://github.com/mvdan/gofumpt/releases/tag/v0.2.0 |
goheader | β¬ | - |
goimports | β | same as gofmt |
golint | β¬ | deprecated and archived |
gomnd | β¬ | - |
gomoddirectives | β¬ | - |
gomodguard | β¬ | - |
goprintffuncname | β¬ | no update for 2 years |
gosec | β¬ | - |
ifshort | β¬ | - |
importas | β¬ | - |
interfacer | β¬ | deprecated and archived |
ireturn | β¬ | - |
lll | β¬ | - |
makezero | β¬ | - |
maligned | β¬ | deprecated and archived |
misspell | β¬ | no update for 4 years |
nakedret | β¬ | - |
nestif | β¬ | - |
nilerr | β¬ | no update for a year |
nilnil | β¬ | - |
nlreturn | β¬ | - |
noctx | β¬ | - |
nolintlint | β¬ | - |
paralleltest | β¬ | - |
prealloc | β¬ | - |
predeclared | β¬ | - |
promlinter | β¬ | - |
revive | β¬ | - |
rowserrcheck | β¬ | - |
scopelint | β¬ | deprecated and archived |
sqlclosecheck | β¬ | - |
stylecheck | β¬ | - |
tagliatelle | β¬ | - |
tenv | β¬ | - |
testpackage | β¬ | - |
thelper | β¬ | - |
tparallel | β¬ | - |
unconvert | β¬ | no update for 2 years |
unparam | β¬ | There is an issue that states that x/tools/go/ssa supports Generics and then supports it. |
varnamelen | β¬ | - |
wastedassign | β¬ | https://github.com/sanposhiho/wastedassign/issues/41 |
whitespace | β¬ | - |
wrapcheck | β | https://github.com/tomarrell/wrapcheck/commit/213318509af6a003be2be752da826d269149ba4d |
wsl | β¬ | - |
Currently, most of the linters do not yet support Generics, and few of them have taken any action to support it. Even if the various linters support Generics, the latest golangci-lint will probably support it in due course. The reason for the lack of support may be that the official x/tools
, including go/ssa, do not yet support Generics1. Therefore, for production services that use golangci-lint regularly, it is better to experiment with Generics in the development environment only, and wait for a while before using it in the production environment. Conversely, it might be a chance to contribute them;)
There may be linters that do not fail with or without Generics. Also, some of them may actually support Generics due to my lack of confirmation, and some of them may support Generics after this post was published because I couldn't keep up with the latest information. In that case, please let me know in the comments.
Top comments (0)