pkgsitegolang.org/x/pkgsite/internal/symbol Index | Files

package symbol

import "golang.org/x/pkgsite/internal/symbol"

Index

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)

Source Files

apigodoc.go compare.go generate.go goapi.go intro.go stdlib.go

Version
v0.0.0-20250218150137-224a1368cf02 (latest)
Published
Feb 18, 2025
Platform
linux/amd64
Imports
25 packages
Last checked
2 months ago

Tools for package owners.