Documentation ¶
Index ¶
Constants ¶
const ( // CompatibilityNotApplicable indicates that there are no changes. CompatibilityNotApplicable ReasonCompatibility = "n/a" // BackwardCompatible indicates that the change is backward-compatible. BackwardCompatible = "compatible" // BackwardIncompatible indicates that the change is backward-incompatible, // and that existing users of the code will break. BackwardIncompatible = "breaking" )
const ( // PackageDiffReasonNotApplicable is applied to packages that have not changed. PackageDiffReasonNotApplicable PackageDiffReason = 0 // PackageDiffReasonExportedTypesRemoved indicates an exported type was removed. PackageDiffReasonExportedTypesRemoved = 1 << iota // PackageDiffReasonExportedTypesAdded indicates an exported type was added. PackageDiffReasonExportedTypesAdded // PackageDiffReasonExportedTypesChanged indicates an exported type was changed. PackageDiffReasonExportedTypesChanged // PackageDiffReasonExportedMembersRemoved indicates an exported member was removed. PackageDiffReasonExportedMembersRemoved // PackageDiffReasonExportedMembersAdded indicates an exported member was added. PackageDiffReasonExportedMembersAdded // PackageDiffReasonExportedMembersChanged indicates an exported member was changed. PackageDiffReasonExportedMembersChanged )
const ( // TypeDiffReasonNotApplicable is applied to types that have not changed. TypeDiffReasonNotApplicable TypeDiffReason = 0 // TypeDiffReasonKindChanged indicates that the kind of the type has changed. TypeDiffReasonKindChanged = 1 << iota // TypeDiffReasonGenericsChanged indicates that the generics of the type have changed. TypeDiffReasonGenericsChanged // TypeDiffReasonParentTypesChanged indicates that the parent type(s) of the type have changed. TypeDiffReasonParentTypesChanged // TypeDiffReasonPricipalTypeChanged indicates that the principal type of the type has changed. TypeDiffReasonPricipalTypeChanged // TypeDiffReasonAttributesAdded indicates that one or more attributes on the type were added. TypeDiffReasonAttributesAdded // TypeDiffReasonAttributesRemoved indicates that one or more attributes on the type were removed. TypeDiffReasonAttributesRemoved // TypeDiffReasonExportedMembersAdded indicates that some exported members // of the type have been added. TypeDiffReasonExportedMembersAdded // TypeDiffReasonExportedMembersRemoved indicates that some exported members // of the type have been removed. TypeDiffReasonExportedMembersRemoved // TypeDiffReasonExportedMembersChanged indicates that some exported members // of the type have been changed, in some manner. TypeDiffReasonExportedMembersChanged // TypeDiffReasonRequiredMemberAdded indicates that a *required* member // of the type has been added. TypeDiffReasonRequiredMemberAdded )
const ( // MemberDiffReasonNotApplicable is applied to members that have not changed. MemberDiffReasonNotApplicable MemberDiffReason = 0 // MemberDiffReasonKindChanged indicates that the kind of the member has changed. MemberDiffReasonKindChanged = 1 << iota // MemberDiffReasonGenericsChanged indicates that the generics of the member have changed. MemberDiffReasonGenericsChanged // MemberDiffReasonParametersCompatible indicates that the parameters of the // member has changed in a forward compatible manner. MemberDiffReasonParametersCompatible // MemberDiffReasonParametersNotCompatible indicates that the parameters of the // member has changed in a forward incompatible manner. MemberDiffReasonParametersNotCompatible // MemberDiffReasonTypeNotCompatible indicates that the declared/return type of the // member has changed in a forward incompatible manner. MemberDiffReasonTypeNotCompatible )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiffFilter ¶
type DiffKind ¶
type DiffKind string
DiffKind defines the various diff kinds.
const ( // Added indicates an item was added. Added DiffKind = "added" // Removed indicates an existing item was removed. Removed DiffKind = "removed" // Changed indicates an existing item was changed. Changed DiffKind = "changed" // Same indicates an existing item remained the same, with no changes. Same DiffKind = "same" )
type MemberDiff ¶
type MemberDiff struct { // Kind defines the kind of this member diff. Kind DiffKind // Name is the name of the member being diffed. Name string // ChangeReason defines the reason the member changed. ChangeReason MemberDiffReason // Original is the original member, if any. Original *typegraph.TGMember `json:"-"` // Updated is the updated member, if any. Updated *typegraph.TGMember `json:"-"` }
MemberDiff defines the diff between two versions of a member.
type MemberDiffReason ¶
type MemberDiffReason int
MemberDiffReason defines a bitwise enumeration specifying why a member changed.
func (MemberDiffReason) Describe ¶
func (mdr MemberDiffReason) Describe() (ReasonCompatibility, string)
Describe describes this member diff reason in its means of compatibility, as well as its human-readable string.
func (MemberDiffReason) Expand ¶
func (mdr MemberDiffReason) Expand() []MemberDiffReason
Expand expands the member diff reason into individual enumeration values.
func (MemberDiffReason) String ¶
func (i MemberDiffReason) String() string
type PackageDiff ¶
type PackageDiff struct { // Kind defines the kind of this package diff. Kind DiffKind // Path defines the path of this package. Path string // ChangeReason defines the reason the package changed. ChangeReason PackageDiffReason // OriginalModules contains all the modules from the original type graph // that are part of this package. OriginalModules []typegraph.TGModule `json:"-"` // UpdatedModules contains all the modules from the updated type graph // that are part of this package. UpdatedModules []typegraph.TGModule `json:"-"` // Types enumerates the differences of the types between the two versions // of the package. Types []TypeDiff // Members enumerates the differences of the module-level members between // the two versions of the package. Members []MemberDiff }
PackageDiff defines the diff between two packages.
func (PackageDiff) HasBreakingChange ¶
func (pd PackageDiff) HasBreakingChange() bool
HasBreakingChange returns true if the package has any *forward incompatible* breaking changes.
func (PackageDiff) HasChange ¶
func (pd PackageDiff) HasChange(change PackageDiffReason) bool
HasChange returns true if the package has the given change as *one* of its changes.
type PackageDiffReason ¶
type PackageDiffReason int
PackageDiffReason defines a bitwise enumeration specifying why a package changed.
func (PackageDiffReason) Describe ¶
func (pdr PackageDiffReason) Describe() (ReasonCompatibility, string)
Describe describes this package diff reason in its means of compatibility, as well as its human-readable string.
func (PackageDiffReason) Expand ¶
func (pdr PackageDiffReason) Expand() []PackageDiffReason
Expand expands the package diff reason into individual enumeration values.
type ReasonCompatibility ¶
type ReasonCompatibility string
ReasonCompatibility describes the compatibility implications of a change.
type TypeDiff ¶
type TypeDiff struct { // Kind defines the kind of this type diff. Kind DiffKind // Name is the name of the type being diffed. Name string // ChangeReason defines the reason the type changed. ChangeReason TypeDiffReason // Original is the original type, if any. Original *typegraph.TGTypeDecl `json:"-"` // Updated is the updated type, if any. Updated *typegraph.TGTypeDecl `json:"-"` // Members enumerates the differences of the members between // the two versions of the type, if any. Members []MemberDiff }
TypeDiff defines the diff between two versions of a type.
type TypeDiffReason ¶
type TypeDiffReason int
TypeDiffReason defines a bitwise enumeration specifying why a type changed.
func (TypeDiffReason) Describe ¶
func (tdr TypeDiffReason) Describe() (ReasonCompatibility, string)
Describe describes this type diff reason in its means of compatibility, as well as its human-readable string.
func (TypeDiffReason) Expand ¶
func (tdr TypeDiffReason) Expand() []TypeDiffReason
Expand expands the type diff reason into individual enumeration values.
func (TypeDiffReason) String ¶
func (i TypeDiffReason) String() string
type TypeGraphDiff ¶
type TypeGraphDiff struct { // Packages enumerates the differences of the packages between the two type graphs. Packages map[string]PackageDiff // Original is a reference to the original type graph. Original *typegraph.TypeGraph `json:"-"` // Updated is a reference to the updated type graph. Updated *typegraph.TypeGraph `json:"-"` }
TypeGraphDiff defines the diff between two type graphs.
func ComputeDiff ¶
func ComputeDiff(original TypeGraphInformation, updated TypeGraphInformation, filters ...DiffFilter) TypeGraphDiff
ComputeDiff computes the differences between the original type graph and the updated type graph.
type TypeGraphInformation ¶
type TypeGraphInformation struct { // Graph is the type graph to diff. Graph *typegraph.TypeGraph // PackageRootPath is the root path from which the type graph was constructed. Used // to normalize all package paths relative to the root, for easy comparison across // type graphs. PackageRootPath string }
TypeGraphInformation specifies the graph information for a type graph to be diff-ed.