modface

package
v0.0.0-...-c5cd7f6 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportsEqual

func ExportsEqual(a, b Export) bool

ExportsEqual returns true if faces are equal, otherwise false.

func Versions

func Versions(moddir string) ([]string, error)

Versions returns all the versions for a module pointed to by moddir.

Types

type Export

type Export interface {
	// String returns a human-readable presentation of the export.
	String() string

	// ID returns a unique identifier for an export.
	// An export's ID must be unique within its package.
	ID() string
	// contains filtered or unexported methods
}

Export represents an export.

type ExportDifference

type ExportDifference struct {
	Old Export
	New Export
}

ExportDifference contains the old and new faces.

type FuncSignature

type FuncSignature struct {
	Name     string
	Receiver Type
	Params   TypeList
	Results  TypeList
}

FuncSignature defines a function signature. The ID is a short signature that should be uniquely identifying. The Signature is a complete representation of the function's interface and should be directly comparable between different commits to ensure that backwards compatibility is maintained.

func ParseFuncSignature

func ParseFuncSignature(decl *ast.FuncDecl) FuncSignature

ParseFuncSignature parses a FuncDecl into a FuncSignature.

func (FuncSignature) ID

func (fs FuncSignature) ID() string

ID returns a unique identifier for the function signature. A package should only have one function with this particular ID.

func (FuncSignature) String

func (fs FuncSignature) String() string

type Module

type Module struct {
	Path     string
	Packages map[string]PackageInterface
}

Module represents a module. The Package member contains all exports of the module.

func ParseModule

func ParseModule(moddir string) (*Module, error)

ParseModule parses a module and returns all of its export signatures.

type ModuleDifference

type ModuleDifference struct {
	ModPath          string
	OldModPath       string
	ModPathsMatch    bool
	PackageRemovals  map[string]PackageInterface
	PackageAdditions map[string]PackageInterface
	PackageChanges   map[string]*PackageDifference
}

ModuleDifference represents the interface difference between two versions of a module.

func Diff

func Diff(oldmod, newmod *Module) *ModuleDifference

Diff computes the interface difference between two versions of a module.

func (ModuleDifference) Any

func (md ModuleDifference) Any() bool

Any returns true if there are any differences, otherwise false.

func (ModuleDifference) Breaking

func (md ModuleDifference) Breaking() bool

Breaking returns true if there are any breaking differences, otherwise false. Any package removals or packages with breaking changes are considered breaking changes for the module.

type ModuleInterface

type ModuleInterface map[string]PackageInterface

ModuleInterface represents all exports of a module.

type PackageDifference

type PackageDifference struct {
	Additions map[string]Export
	Removals  map[string]Export
	Changes   map[string]ExportDifference
}

PackageDifference returns the interface differences between two versions of a package.

func PackageDiff

func PackageDiff(oldpack, newpack PackageInterface) *PackageDifference

PackageDiff returns an object representing the difference between two package versions.

func (PackageDifference) Any

func (pd PackageDifference) Any() bool

Any returns true if there are any differences, otherwise false.

func (PackageDifference) Breaking

func (pd PackageDifference) Breaking() bool

Breaking returns true if there are any breaking differences, otherwise false. Any interface removals or changes in signature are considered breaking changes.

type PackageInterface

type PackageInterface map[string]Export

PackageInterface represents all exports of a package.

type Type

type Type struct {
	Name      string
	IsPointer bool
}

Type defines a type that can be used for params, results, and receivers.

func (Type) IsDefined

func (t Type) IsDefined() bool

IsDefined returns true if the type is not defined, otherwise false.

func (Type) IsExported

func (t Type) IsExported() bool

IsExported returns true if the type is exported, otherwise false.

func (Type) String

func (t Type) String() string

type TypeList

type TypeList []Type

TypeList is a list of Type instances for function params and results.

func (TypeList) String

func (tl TypeList) String() string

Jump to

Keyboard shortcuts

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