Involved Source Filesdiff.go Package apidiff compares exported Go package APIs between two VCS revisions
using golang.org/x/exp/apidiff and evaluates semantic version compatibility.load.go
Package-Level Type Names (total 3, all are exported)
/* sort exporteds by: | */
ModuleDiff summarizes exported API changes for a Go module between two revisions.AddedPackages[]stringPackages[]PackageDiffRemovedPackages[]string CheckCompatibility checks whether bumping from latestVer to targetVer
satisfies Standard Go semver rules for the detected API changes. HasCompatible reports whether the diff contains any backwards-compatible API
additions (new exported packages or compatible symbol additions). HasIncompatible reports whether the diff contains any breaking API changes
(incompatible symbol changes or removed exported packages). IsEmpty reports whether no exported API changes were detected. SuggestedBump returns the semantic version bump recommended by Standard Go
semver rules given latestVer and this API diff:
- v0.x.y: incompatible or compatible API changes -> minor; internal -> patch
- v1+: incompatible -> major; compatible -> minor; internal -> patch
func Compare(ctx context.Context, v vcs.VCS, oldRev, newRev, modDir string, workspaceDirs []string) (ModuleDiff, error)
func CompareBatch(ctx context.Context, v vcs.VCS, newRev string, reqs []ModuleRequest, workspaceDirs []string) (map[string]ModuleDiff, error)
func DiffPackages(oldPkgs, newPkgs []*packages.Package) ModuleDiff
Package-Level Functions (total 8, in which 3 are exported)
Compare loads exported packages for modDir at oldRev and newRev via v and
returns their API diff. workspaceDirs lists all repo-relative module dirs so
intra-workspace dependencies resolve locally without hitting a remote proxy.
CompareBatch compares multiple modules against their respective OldRevs in a
single batched pass. Each unique commit revision is exported and loaded at
most once, and distinct commits are loaded concurrently.
DiffPackages compares two sets of loaded Go packages, ignoring main and
internal packages.