impl

package
v1.0.1-0...-cffed86 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenStubs

func GenStubs(recv string, fns []Func, implemented map[string]bool) []byte

GenStubs prints nicely formatted method stubs for fns using receiver expression recv. If recv is not a valid receiver expression, GenStubs will panic. GenStubs won't generate stubs for already implemented methods of receiver.

func ImplementedFuncs

func ImplementedFuncs(fns []Func, recv string, srcDir string) (map[string]bool, error)

ImplementedFuncs returns list of Func which already implemented.

func ValidReceiver

func ValidReceiver(recv string) bool

ValidReceiver reports whether recv is a valid receiver expression.

Types

type Func

type Func struct {
	Name     string
	Params   []Param
	Res      []Param
	Comments string
}

Func represents a function signature.

func Funcs

func Funcs(iface string, srcDir string) ([]Func, error)

Funcs returns the set of methods required to implement iface. It is called Funcs rather than methods because the function descriptions are functions; there is no receiver.

type Method

type Method struct {
	Recv string
	Func
}

Method represents a method signature.

type Param

type Param struct {
	Name string
	Type string
}

Param represents a parameter in a function or method signature.

type Pkg

type Pkg struct {
	*build.Package
	*token.FileSet
}

Pkg is a parsed build.Package.

type Spec

type Spec struct {
	*ast.TypeSpec
	ast.CommentMap
}

Spec is ast.TypeSpec with the associated comment map.

Jump to

Keyboard shortcuts

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