Skip to content

Enforce that interface{} is spelled any #1344

Closed as not planned
Closed as not planned
@cespare

Description

@cespare

I propose to flag when interface{} is written instead of any. Maybe for Go 1.20+ or so, since it was added in Go 1.18?

It's easy to fix up a codebase to use any with, for instance,

gofmt -w -r 'interface{} -> any' .

I suspect this might be controversial but I wanted to throw it out there since I'm implementing this now in our company-internal linter.

(I feel like there must have been previous discussion about this, either as part of staticcheck or as part of vet or even as an automatic gofmt feature, but my searches haven't turned up anything. It's difficult to search for these terms.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-decisionWe have to decide if this check is feasible and desirablenew-check

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions