symbol

package
v0.0.0-...-87c4152 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareAPIVersions

func CompareAPIVersions(path string, apiVersions pkgAPIVersions, inSH *internal.SymbolHistory) ([]string, error)

CompareAPIVersions returns the differences between apiVersions and inVersionToNameToUnitSymbol.

func FeaturesForVersion

func FeaturesForVersion(featureCtx map[string]map[string]bool,
	prevFeatureSet map[string]bool) (newFeatures []string, featureSet map[string]bool)

FeaturesForVersion returns the set of features introduced at a given version.

featureCtx contains all features at this version. prevFeatureSet contains all features in the previous version. newFeatures contains only features introduced at this version. allFeatures contains all features in the package at this version.

func GenerateFeatureContexts

func GenerateFeatureContexts(ctx context.Context, pkgPath, pkgDir string) (map[string]map[string]bool, error)

GenerateFeatureContexts computes the exported API for the package specified by pkgPath. The source code for that package is in pkgDir.

It is largely adapted from https://go.googlesource.com/go/+/refs/heads/master/src/cmd/api/goapi.go.

func IntroducedHistory

func IntroducedHistory(sh *internal.SymbolHistory) (outSH *internal.SymbolHistory, err error)

IntroducedHistory returns a map of the first version when a symbol name is added to the API, to the symbol name, to the UnitSymbol struct. The UnitSymbol.Children field will always be empty, as children names are also tracked.

func LoadAPIFiles

func LoadAPIFiles(pkgPath, dir string) ([]string, error)

LoadAPIFiles loads data about the API for the given package from dir.

func ParsePackageAPIInfo

func ParsePackageAPIInfo(files []string) (_ apiVersions, err error)

ParsePackageAPIInfo parses apiVersions using contents of the specified directory.

Types

type Walker

type Walker struct {
	// contains filtered or unexported fields
}

Walker is the same as Walkter from https://go.googlesource.com/go/+/refs/heads/master/src/cmd/api/goapi.go, except Walker.stdPackages was renamed to Walker.packages.

func NewWalker

func NewWalker(context *build.Context, pkgPath, pkgDir, root string) *Walker

NewWalker is the same as https://go.googlesource.com/go/+/refs/tags/go1.16.6/src/cmd/api/goapi.go#376, except w.context.Dir is set to pkgDir.

func (*Walker) Features

func (w *Walker) Features() (fs []string)

func (*Walker) Import

func (w *Walker) Import(name string) (*types.Package, error)

func (*Walker) ImportFrom

func (w *Walker) ImportFrom(fromPath, fromDir string, mode types.ImportMode) (*types.Package, error)

Jump to

Keyboard shortcuts

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