recv

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

Recv

A linter that handles methods receivers.

Examples

package a

type Foo struct { // want `the methods of "Foo" use different receiver names: f, fo.`
	Name string
}

func (f Foo) A()  {}
func (fo Foo) B() {}

type Bar struct{} // want `the methods of "Bar" use pointer receiver and non pointer receiver.`

func (b Bar) A()  {}
func (b *Bar) B() {}

type Fuu struct{}

func (faaa Fuu) A() {} // want `the receiver name "faaa" is too long.`

References

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config Config) *analysis.Analyzer

New creates an analyzer.

Types

type Config

type Config struct {
	// MaxNameLength maximum length for a receiver name.
	MaxNameLength int
	// TypeConsistency allows to use pointer receiver and non-pointer receiver on the same struct.
	TypeConsistency bool
}

Config the recv configuration.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL