Skip to content

cmd/vet: audit / update vet analyzer handling of generic code #48704

Closed
@findleyr

Description

@findleyr

Umbrella issue: we need to verify that the vet analyzers in x/tools are well behaved with generic code, before they are vendored into the standard library as part of the Go 1.18 release cycle.

The majority of the analyzers require no additional logic for the new language constructs. In most of these cases, we should still add test coverage. This coverage needs to be added both in x/tools, and in cmd/vet/testdata. We can start with x/tools and add tests to cmd/vet once our changes have been vendored.

In some cases, analyzers will require new logic to handle type parameters. For example, the printf analyzer could consider the structural restrictions on a type parameter (e.g. interface { ~int }), and offer diagnostics if a particular verb is incompatible with this structural restriction (I put together a proof of concept CL for this). But the solution in that CL is not obviously correct: we can't know whether a type argument implements fmt.Formatter. Where such non-trivial decisions are required, we should have a separate proposal issue that will be referenced here.

I'll keep this top comment updated with the current state of analyzers:

CC @timothy-king @golang/tools-team

(N.B.: I'm filing this issue during quiet week, because we need it to track ongoing CLs. Please note that we might not be responsive to discussion about vet changes this week, but that there will be time for discussion later).

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.release-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions