8000 ST1021: False positive for type parameters in comment · Issue #1857 · dominikh/go-tools · GitHub
[go: up one dir, main page]

Skip to content

ST1021: False positive for type parameters in comment #1857

Backlog

Description

@twpayne

Firstly, thank you for this excellent software! staticcheck has been invaluable for me for years.

ST1021 gives a false positive for:

// A Set[E] is a set of elements of type E.
type Set[E comparable] map[E]struct{}
$ go run honnef.co/go/tools/cmd/staticcheck@2026.2.2 -checks ST1021 ./set
set/set.go:34:1: comment on exported type Set should be of the form "Set ..." (with optional leading article) (ST1021)
exit status 1

This example is from golang.org/x/exp/container/set.

The latest version of static check (8371db7) reports the same false positive, and I could not find an existing issue describing this problem.

Debug info:

$ go run honnef.co/go/tools/cmd/staticcheck@2026.2.2 -version
staticcheck 2026.2.2 (0.8.2)

$ go run honnef.co/go/tools/cmd/staticcheck@2026.2.2 -debug.version
staticcheck 2026.2.2 (0.8.2)

Compiled with Go version: go1.27.4-X:nodwarf5
Main module:
        honnef.co/go/tools@v0.8.2 (sum: h1:+jPbCzuYxYrcoOvCecYUFDj+XJQRmzIhJmlbpps21Zk=)
Dependencies:
        github.com/BurntSushi/toml@v1.4.1-0.20240526193622-a339e1f7089c (sum: h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs=)
        golang.org/x/exp/typeparams@v0.0.0-20231108232855-2478ac86f678 (sum: h1:1P7xPZEwZMoBoz0Yze5Nx2/4pxj6nw9ZqHWXqP0iRgQ=)
        golang.org/x/mod@v0.41.0 (sum: h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c=)
        golang.org/x/sync@v0.23.0 (sum: h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk=)
        golang.org/x/tools@v0.51.0 (sum: h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI=)

$ go version
go version go1.27.4-X:nodwarf5 linux/amd64

$ go env
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN='/home/twp/.local/bin'
GOCACHE='/home/twp/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/twp/.config/go/env'
GOEXE=''
GOEXPERIMENT='nodwarf5'
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build530408478=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/home/twp/src/github.com/golang/exp/collection/go.mod'
GOMODCACHE='/home/twp/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPACKAGESDRIVER=''
GOPATH='/home/twp/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/twp/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.27.4-X:nodwarf5'
GOWORK=''
PKG_CONFIG='pkg-config'

Activity

  1. added
    needs-triage
    on Dec 2, 2026
  2. removed
    needs-triage
    on Dec 3, 2026
  3. dominikh commented on Dec 3, 2026

    @dominikh
    Owner

    Will fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0