Skip to content

Distinguish generic types #669

Closed
@palsivertsen

Description

@palsivertsen

Describe the bug
Revive reports receiver name error at first and only declaration.

To Reproduce
Run revive on this code:

package example

type Foo[T any] struct{}

func (f *Foo[T]) Foo() {}

type Bar[T comparable] struct{}

func (b *Bar[T]) Bar() {}
 $ revive --version && revive
version 1.1.4
example.go:9:1: receiver name b should be consistent with previous receiver name f for invalid-type
example.go:3:6: exported type Foo should have comment or be unexported
example.go:7:6: exported type Bar should have comment or be unexported

Expected behavior

  1. I expected to not see any errors regarding receiver types.
  2. The receiver error should not report "invalid-type".

Desktop (please complete the following information):

  • OS: Arch Linux
  • go version go1.18 linux/amd64

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions