Skip to content

Be smarter about which methods can have their names changed #3

Open
@mvdan

Description

@mvdan

Changing all method names will break some programs, as method names are necessary to implement interfaces.

On the otherhand, not touching any method names exposes far too much information. It's likely that only a minority of methods actually implement interfaces.

Of course, this is a difficult problem to solve, because for a library package it's impossible to tell which methods are meant to implement which interfaces. Perhaps it's only a package that imports our library which uses a type as an interface with methods, since a type doesn't have to be upfront about what interfaces it implements.

We implemented a conservative version of this algorithm for https://github.com/mvdan/unparam, so perhaps we can reuse it.

Right now, we grable method names only if they are unexported, which is a reasonable shortcut until we have a better mechanism.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions