Description
Many tools and libraries that operate on Go code need to be updated to support generics. In most cases, this requires handling of the new constructs introduced in go/ast
and go/types
.
This is a tracking issue for the status of this support. It is based on #24661, which did the same for modules, though I added several tools/packages, and removed any that have been archived or that don't work directly with Go code.
It is not the case that every tool listed here needs updates to support generics -- many will require no changes. However, any tool that interacts with Go code might need to be updated, and probably needs additional tests.
Issue #50447 tracks adding a transitional API + user guide that should make it easier to get started updating third-party tools.
How to Help
- Suggest additions to the list below. This list is certainly incomplete. Any tool or library that operates on Go code is a candidate for updating.
- Comment if you're aware of the status of generics support in any of the items below, and I'll update accordingly (or update this comment yourself if you can).
- Try building any of the tools below with Go 1.18, and test them on generic Go code. Comment with your findings.
- Send a PR to update any of the tools below to support generics (this will probably be easier once x/exp/typeparams: a new module with a transitional API for tools #50447 is resolved).
List of tools / packages
- apicompat
- counterfeiter
- delve
- dupl
- errcheck
- fillstruct - available through
gopls
- goa/goagen
go-langserver- usegopls
instead- go-critic
- go-fuzz (Note that Go 1.18 has native fuzzing)
- go-outline - see tools: replace
go-outline
withgopls
vscode-go#1020 for implementing this functionality in gopls - go-symbols - TODO: which fork is canonical?
- goast-viewer
gocode- replaced bygopls
- goconst
- gocyclo - in progress?
- godef
- godoctor - available through
gopls
- go doc
- go fmt - also available through
gopls
- go vet - cmd/vet: audit / update vet analyzer handling of generic code #48704; also available through
gopls
- gofumpt - also available through
gopls
- golines
- gogetdoc
- golangci-lint - Partial generics support -- not all linters are updated see Support of generics golangci/golangci-lint#2649
- gomodifytags - (see also tools: merge
gomodifytags
functionality intogopls
and usegopls
vscode-go#2002 for merging this functionality with gopls) - gopherjs - GopherJS generics support gopherjs/gopherjs#1013
- goreturns - available through
gopls
- go-sumtype
- goswagger
- gotags
- gotests - works, has no special support for generic functions Generic function support cweill/gotests#165
- gotext
- gqlgen
- impl - see also x/tools/gopls: generate method stubs for a given interface #37537 for merging this functionality with gopls
- ineffassign
- keyify
- lll - likely no update required
- maligned
- misspell
- modver
- moq
- mockery
- motion
- nakedret
- pkgsite - x/pkgsite: add support for type parameters #48264
- revive
- semgrep
- staticcheck - works since version 2022.1; gopls still needs to be updated
- unconvert
- unparam
- x/tools/cmd/bundle
x/tools/cmd/godoc- replaced by pkgsite- x/tools/cmd/goimports - also available through
gopls
- x/tools/cmd/gotype - no update required
- x/tools/cmd/gomvpkg
- x/tools/cmd/gorename - available through
gopls
x/tools/cmd/guru- replaced bygopls
- x/tools/cmd/stringer - https://golang.org/cl/355313
- x/tools/go/analysis - no update required
- go/analysis/passes/asmdecl
- go/analysis/passes/assign
- go/analysis/passes/atomic
- go/analysis/passes/atomicalign
- go/analysis/passes/bools
- go/analysis/passes/buildssa
- go/analysis/passes/buildtag
- go/analysis/passes/cgocall
- go/analysis/passes/composite
- go/analysis/passes/copylock
- go/analysis/passes/ctrlflow
- go/analysis/passes/deepequalerrors
- go/analysis/passes/errorsas
- go/analysis/passes/fieldalignment
- go/analysis/passes/findcall
- go/analysis/passes/framepointer
- go/analysis/passes/httpresponse
- go/analysis/passes/ifaceassert
- go/analysis/passes/inspect
- go/analysis/passes/internal/analysisutil
- go/analysis/passes/loopclosure
- go/analysis/passes/lostcancel
- go/analysis/passes/nilfunc
- go/analysis/passes/nilness
- go/analysis/passes/pkgfact
- go/analysis/passes/printf
- go/analysis/passes/reflectvaluecompare
- go/analysis/passes/shadow
- go/analysis/passes/shift
- go/analysis/passes/sigchanyzer
- go/analysis/passes/sortslice
- go/analysis/passes/stdmethods
- go/analysis/passes/stringintconv
- go/analysis/passes/structtag
- go/analysis/passes/testinggoroutine
- go/analysis/passes/tests
- go/analysis/passes/unmarshal
- go/analysis/passes/unreachable
- go/analysis/passes/unsafeptr
- go/analysis/passes/unusedresult
- go/analysis/passes/unusedwrite
- go/analysis/unitchecker
- x/tools/go/analysistest - no update required
- x/tools/go/ast/astutil
- x/tools/go/ast/inspector
x/tools/go/loader- Deprecated: replaced by go/packages- x/tools/go/packages
- x/tools/go/ssa - x/tools/go/ssa: generics support #48525
- x/tools/go/types/objectpath
- x/tools/go/types/typeutil
- x/tools/gopls - works with default options; some analyzers may panic
- x/tools/refactor/eg
- x/tools/refactor/rename
- x/tools/refactor/satisfy