versions

package
v0.0.0-...-86cb477 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructUnitURL

func ConstructUnitURL(fullPath, modulePath, requestedVersion string) string

ConstructUnitURL returns a URL path that refers to the given unit at the requested version. If requestedVersion is "latest", then the resulting path has no version; otherwise, it has requestedVersion.

func DisplayVersion

func DisplayVersion(modulePath, requestedVersion, resolvedVersion string) string

DisplayVersion returns the version string, formatted for display.

func LinkVersion

func LinkVersion(modulePath, requestedVersion, resolvedVersion string) string

LinkVersion returns the version string, suitable for use in a link to this site. See TestLinkVersion for examples.

func ParseVersionsDetails

func ParseVersionsDetails(vd *VersionsDetails) (_ *internal.SymbolHistory, err error)

ParseVersionsDetails returns a map of versionToNameToUnitSymbol based on data from the provided VersionDetails.

Types

type Symbol

type Symbol struct {
	// Name is name of the symbol. At a given package version, name must be
	// unique.
	Name string

	// Synopsis is the one line description of the symbol that is displayed.
	Synopsis string

	// Section is the section that a symbol appears in.
	Section internal.SymbolSection

	// Kind is the type of a symbol, which is either a constant, variable,
	// function, type, field or method.
	Kind internal.SymbolKind

	// Link is the link to the symbol name on pkg.go.dev.
	Link string

	// Children contain the child symbols for this symbol. This will
	// only be populated when the SymbolType is "Type". For example, the
	// children of net/http.Handler are FileServer, NotFoundHandler,
	// RedirectHandler, StripPrefix, and TimeoutHandler. Each child
	// symbol will have ParentName set to the Name of this type.
	Children []*Symbol

	// Builds lists all of the build contexts supported by the symbol, it is
	// only available for limited set of builds. If the symbol supports all
	// build contexts, Builds will be nil.
	Builds []string

	// New indicates that the symbol is new as of the version where it is
	// present. For example, if type Client was introduced in v1.0.0 and
	// Client.Timeout was introduced in v1.1.0, New will be false for Client
	// and true for Client.Timeout if this Symbol corresponds to v1.1.0.
	New bool
	// contains filtered or unexported fields
}

Symbol is an element in the package API. A symbol can be a constant, variable, function, type, field or method.

type VersionList

type VersionList struct {
	VersionListKey
	// Deprecated indicates whether the major version is deprecated.
	Deprecated bool
	// DeprecationComment holds the reason for deprecation, if any.
	DeprecationComment string
	// Versions holds the nested version summaries, organized in descending
	// semver order.
	Versions []*VersionSummary
}

VersionList holds all versions corresponding to a unique (module path, major version) tuple in the version hierarchy.

type VersionListKey

type VersionListKey struct {
	// ModulePath is the module path of this major version.
	ModulePath string

	// Major is the major version string (e.g. v1, v2)
	Major string

	// Incompatible indicates whether the VersionListKey represents an
	// incompatible module version.
	Incompatible bool
}

VersionListKey identifies a version list on the versions tab. We have a separate VersionList for each major version of a module series. Notably we have more version lists than module paths: v0 and v1 module versions are in separate version lists, despite having the same module path. Also note that major version isn't sufficient as a key: there are packages contained in the same major version of different modules, for example github.com/hashicorp/vault/api, which exists in v1 of both of github.com/hashicorp/vault and github.com/hashicorp/vault/api.

type VersionSummary

type VersionSummary struct {
	CommitTime string
	// Link to this version, for use in the anchor href.
	Link                string
	Version             string
	Retracted           bool
	RetractionRationale string
	IsMinor             bool
	Symbols             [][]*Symbol
	Vulns               []vuln.Vuln
}

VersionSummary holds data required to format the version link on the versions tab.

type VersionsDetails

type VersionsDetails struct {
	// ThisModule is the slice of VersionLists with the same module path as the
	// current package.
	ThisModule []*VersionList

	// IncompatibleModules is the slice of the VersionsLists with the same
	// module path as the current package, but with incompatible versions.
	IncompatibleModules []*VersionList

	// OtherModules is the slice of VersionLists with a different module path
	// from the current package.
	OtherModules []string
}

VersionsDetails contains the hierarchy of version summary information used to populate the version tab. Version information is organized into separate lists, one for each (ModulePath, Major Version) pair.

func FetchVersionsDetails

func FetchVersionsDetails(ctx context.Context, ds internal.DataSource, um *internal.UnitMeta, vc *vuln.Client) (*VersionsDetails, error)

Jump to

Keyboard shortcuts

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