internal

package
v0.0.0-...-642d756 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Overview

Package internal contains data used through x/pkgsite.

Index

Constants

View Source
const (
	// LatestVersion signifies the latest available version in requests to the
	// proxy client.
	LatestVersion = "latest"

	// MainVersion represents the main branch.
	MainVersion = "main"

	// MasterVersion represents the master branch.
	MasterVersion = "master"

	// UnknownModulePath signifies that the module path for a given package
	// path is ambiguous or not known. This is because requests to the
	// frontend can come in the form of <import-path>[@<version>], and it is
	// not clear which part of the import-path is the module path.
	UnknownModulePath = "unknownModulePath"
)
View Source
const All = "all"

All represents all values for a build context element (GOOS or GOARCH).

View Source
const (
	ExperimentEnableStdFrontendFetch = "enable-std-frontend-fetch"
)
View Source
const StringFieldMissing = "!MISSING"

StringFieldMissing is the value for string fields that are not present in a struct. We use it to distinguish a (possibly valid) empty string from a field that was never populated.

Variables

View Source
var (
	BuildContextAll     = BuildContext{All, All}
	BuildContextLinux   = BuildContext{"linux", "amd64"}
	BuildContextWindows = BuildContext{"windows", "amd64"}
	BuildContextDarwin  = BuildContext{"darwin", "amd64"}
	BuildContextJS      = BuildContext{"js", "wasm"}
)

BuildContexts are the build contexts we check when loading a package (see internal/fetch/load.go). We store documentation for all of the listed contexts. The order determines which environment's docs we will show as the default.

View Source
var DefaultBranches = map[string]bool{
	MainVersion:   true,
	MasterVersion: true,
}

DefaultBranches are default branches that are supported by pkgsite.

View Source
var Experiments = map[string]string{
	ExperimentEnableStdFrontendFetch: "Enable frontend fetching for module std.",
}

Experiments represents all of the active experiments in the codebase and a description of each experiment.

View Source
var TopLevelDomains = map[string]bool{}/* 176 elements not displayed */

TopLevelDomains contains all of the top level domains in the discovery database.

Functions

func CandidateModulePaths

func CandidateModulePaths(fullPath string) []string

CandidateModulePaths returns the potential module paths that could contain the fullPath, from longest to shortest. It returns nil if no valid module paths can be constructed.

func CompareBuildContexts

func CompareBuildContexts(c1, c2 BuildContext) int

CompareBuildContexts returns a negative number, 0, or a positive number depending on the relative positions of c1 and c2 in BuildContexts.

func IsGoPkgInPathElement

func IsGoPkgInPathElement(p string) bool

IsGoPkgInPathElement reports whether p is an element of a gopkg.in path. It returns true if p has "gopkg.in" as a prefix, or the suffix is a major version, for example "yaml.v2".

func MajorVersionForModule

func MajorVersionForModule(modulePath string) string

MajorVersionForModule returns the final "vN" from the module path, if any. It returns the empty string if the module path is malformed. Examples:

"m.com" => ""
"m.com/v2" => "v2"
"gpkg.in/m.v1 = "v1"

func NewContextWithRequestInfo

func NewContextWithRequestInfo(ctx context.Context, ri *RequestInfo) context.Context

NewContextWithRequestInfo creates a new context from ctx that adds the trace ID.

func ReadFileLines

func ReadFileLines(filename string) (lines []string, err error)

ReadFileLines reads and returns the lines from a file. Whitespace on each line is trimmed. Blank lines and lines beginning with '#' are ignored.

func RequestState

func RequestState(ctx context.Context, s string) func()

RequestState sets the State field of the current request. It returns a function that restores the value of the field. Typical use:

defer RequestState(ctx, "frobbing")()

func SeriesPathAndMajorVersion

func SeriesPathAndMajorVersion(modulePath string) (string, int)

SeriesPathAndMajorVersion splits modulePath into a series path and a numeric major version. If the path doesn't have a "vN" suffix, it returns 1. If the module path is invalid, it returns ("", 0).

func SeriesPathForModule

func SeriesPathForModule(modulePath string) string

SeriesPathForModule returns the series path for the provided modulePath.

func Suffix

func Suffix(fullPath, basePath string) string

Suffix returns the suffix of the fullPath. It assumes that basePath is a prefix of fullPath. If fullPath and basePath are the same, the empty string is returned.

func V1Path

func V1Path(fullPath, modulePath string) string

V1Path returns the path for version 1 of the package whose import path is fullPath. If modulePath is the standard library, then V1Path returns fullPath.

func VCSHostWithThreeElementRepoName

func VCSHostWithThreeElementRepoName(hostname string) bool

VCSHostWithThreeElementRepoName returns true when the hostname has three elements like hostname/account/project.

Types

type BuildContext

type BuildContext struct {
	GOOS, GOARCH string
}

A BuildContext describes a build context for the Go tool: information needed to build a Go package. For our purposes, we only care about the information that affects documentation generated from the package.

func (BuildContext) Match

func (pattern BuildContext) Match(target BuildContext) bool

Match reports whether its receiver, which acts like a pattern, matches its target, an ordinary BuildContext. In addition to the usual values, a pattern can have an empty GOOS or GOARCH, which means "match anything."

func (BuildContext) String

func (b BuildContext) String() string

String returns a string formatted representation of the build context.

type DataSource

type DataSource interface {

	// GetNestedModules returns the latest major version of all nested modules
	// given a modulePath path prefix.
	GetNestedModules(ctx context.Context, modulePath string) ([]*ModuleInfo, error)
	// GetUnit returns information about a directory, which may also be a
	// module and/or package. The module and version must both be known.
	// The BuildContext selects the documentation to read.
	GetUnit(ctx context.Context, pathInfo *UnitMeta, fields FieldSet, bc BuildContext) (_ *Unit, err error)
	// GetUnitMeta returns information about a path.
	GetUnitMeta(ctx context.Context, path, requestedModulePath, requestedVersion string) (_ *UnitMeta, err error)
	// GetModuleReadme gets the readme for the module.
	GetModuleReadme(ctx context.Context, modulePath, resolvedVersion string) (*Readme, error)
	// GetLatestInfo gets information about the latest versions of a unit and module.
	// See LatestInfo for documentation.
	GetLatestInfo(ctx context.Context, unitPath, modulePath string, latestUnitMeta *UnitMeta) (LatestInfo, error)

	// SearchSupport reports the search types supported by this datasource.
	SearchSupport() SearchSupport
	// Search searches for packages matching the given query.
	Search(ctx context.Context, q string, opts SearchOptions) (_ []*SearchResult, err error)
}

DataSource is the interface used by the frontend to interact with module data.

type Documentation

type Documentation struct {
	// The values of the GOOS and GOARCH environment variables used to parse the
	// package.
	GOOS     string
	GOARCH   string
	Synopsis string
	Source   []byte // encoded ast.Files; see godoc.Package.Encode
	API      []*Symbol
}

Documentation is the rendered documentation for a given package for a specific GOOS and GOARCH.

func DocumentationForBuildContext

func DocumentationForBuildContext(docs []*Documentation, bc BuildContext) *Documentation

DocumentationForBuildContext returns the first Documentation the list that matches the BuildContext, or nil if none does. A Documentation matches if its GOOS and GOARCH fields are the same as those of the BuildContext, or if the Documentation field is "all", or if the BuildContext field is empty. That is, empty BuildContext fields act as wildcards. So the zero BuildContext will match the first element of docs, if there is one.

func (*Documentation) BuildContext

func (d *Documentation) BuildContext() BuildContext

BuildContext returns the BuildContext for d.

type Experiment

type Experiment struct {

	// Name is the name of the feature.
	Name string

	// Rollout is the percentage of requests enrolled in the experiment.
	Rollout uint

	// Description provides a description of the experiment.
	Description string
}

Experiment holds data associated with an experimental feature for frontend or worker.

type FieldSet

type FieldSet int64

A FieldSet is a bit set of struct fields. It is used to avoid reading large struct fields from the data store. FieldSet is also the type of the individual bit values. (Think of them as singleton sets.)

MinimalFields (the zero value) is the empty set. AllFields is the set containing every field.

FieldSet bits are unique across the entire project, because some types are concatenations (via embedding) of others. For example, a

const (
	WithMain FieldSet = 1 << iota
	WithImports
	WithLicenses
)

FieldSet bits for fields that can be conditionally read from the data store.

const AllFields FieldSet = -1

AllFields is the FieldSet that contains all fields.

const MinimalFields FieldSet = 0

MinimalFields is the empty FieldSet.

type IndexVersion

type IndexVersion struct {
	Path      string
	Version   string
	Timestamp time.Time
}

IndexVersion holds the version information returned by the module index.

type LatestInfo

type LatestInfo struct {
	// MinorVersion is the latest minor version for the unit, regardless of
	// module.
	MinorVersion string

	// MinorModulePath is the module path for MinorVersion.
	MinorModulePath string

	// UnitExistsAtMinor is whether the unit exists at the latest minor version
	// of the module
	UnitExistsAtMinor bool

	// MajorModulePath is the path of the latest module path in the series.
	// For example, in the module path "github.com/casbin/casbin", there
	// is another module path with a greater major version
	// "github.com/casbin/casbin/v3". This field will be
	// "github.com/casbin/casbin/v3" or the input module path if no later module
	// path was found.
	MajorModulePath string

	// MajorUnitPath is the path of the unit in the latest major version of the
	// module, if it exists. For example, if the module is M, the unit is M/U,
	// and the latest major version is 3, then is field is "M/v3/U". If the module version
	// at MajorModulePath does not contain this unit, then it is the module path."
	MajorUnitPath string
}

LatestInfo holds information about the latest versions and paths. The information is relative to a unit in a module.

type LatestModuleVersions

type LatestModuleVersions struct {
	ModulePath    string
	RawVersion    string        // ignoring retractions
	CookedVersion string        // considering retractions
	GoodVersion   string        // successfully processed
	GoModFile     *modfile.File // of raw
	Deprecated    bool
	// contains filtered or unexported fields
}

LatestModuleVersions describes the latest versions of a module. It also holds the go.mod file of the raw latest version, which establishes whether the module is deprecated, and what versions are retracted.

func NewLatestModuleVersions

func NewLatestModuleVersions(modulePath, raw, cooked, good string, modBytes []byte) (*LatestModuleVersions, error)

func (*LatestModuleVersions) IsRetracted

func (li *LatestModuleVersions) IsRetracted(version string) bool

IsRetracted reports whether the version is retracted according to the go.mod file in the receiver.

func (*LatestModuleVersions) PopulateModuleInfo

func (li *LatestModuleVersions) PopulateModuleInfo(mi *ModuleInfo)

PopulateModuleInfo uses the LatestModuleVersions to populate fields of the given module.

type Module

type Module struct {
	ModuleInfo
	// Licenses holds all licenses within this module version, including those
	// that may be contained in nested subdirectories.
	Licenses []*licenses.License
	Units    []*Unit
}

A Module is a specific, reproducible build of a module.

func (*Module) Packages

func (m *Module) Packages() []*Unit

Packages returns all of the units for a module that are packages.

func (*Module) RemoveNonRedistributableData

func (m *Module) RemoveNonRedistributableData()

type ModuleInfo

type ModuleInfo struct {
	ModulePath        string
	Version           string
	CommitTime        time.Time
	IsRedistributable bool
	// HasGoMod describes whether the module zip has a go.mod file.
	HasGoMod   bool
	SourceInfo *source.Info

	// Deprecated describes whether the module is deprecated.
	Deprecated bool
	// DeprecationComment is the comment describing the deprecation, if any.
	DeprecationComment string
	// Retracted describes whether the module version is retracted.
	Retracted bool
	// RetractionRationale is the reason for the retraction, if any.
	RetractionRationale string
}

ModuleInfo holds metadata associated with a module.

func (*ModuleInfo) SeriesPath

func (v *ModuleInfo) SeriesPath() string

SeriesPath returns the series path for the module.

A series is a group of modules that share the same base path and are assumed to be major-version variants.

The series path is the module path without the version. For most modules, this will be the module path for all module versions with major version 0 or 1. For gopkg.in modules, the series path does not correspond to any module version.

Examples: The module paths "a/b" and "a/b/v2" both have series path "a/b". The module paths "gopkg.in/yaml.v1" and "gopkg.in/yaml.v2" both have series path "gopkg.in/yaml".

type ModuleVersionState

type ModuleVersionState struct {
	ModulePath string
	Version    string

	// IndexTimestamp is the timestamp received from the Index for this version,
	// which should correspond to the time this version was committed to the
	// Index.
	//
	// This may be nil if the request only came via frontend fetch, or the
	// status is not a 2xx status.
	IndexTimestamp *time.Time

	// CreatedAt is the time this version was originally inserted into the
	// module version state table.
	CreatedAt time.Time

	// Status is the most recent HTTP status code received from the Fetch service
	// for this version, or nil if no request to the fetch service has been made.
	Status int
	// Error is the most recent HTTP response body received from the Fetch
	// service, for a response with an unsuccessful status code. It is used for
	// debugging only, and has no semantic significance.
	Error string
	// TryCount is the number of times a fetch of this version has been
	// attempted.
	TryCount int
	// LastProcessedAt is the last time this version was updated with a result
	// from the fetch service.
	LastProcessedAt *time.Time
	// NextProcessedAfter is the next time a fetch for this version should be
	// attempted.
	NextProcessedAfter time.Time

	// AppVersion is the value of the GAE_VERSION environment variable, which is
	// set by app engine. It is a timestamp in the format 20190709t112655 that
	// is close to, but not the same as, the deployment time. For example, the
	// deployment time for the above timestamp might be Jul 9, 2019, 11:29:59 AM.
	AppVersion string

	// HasGoMod says whether the zip file has a go.mod file.
	HasGoMod bool

	// GoModPath is the path declared in the go.mod file fetched from the proxy.
	GoModPath string

	// NumPackages it the number of packages that were processed as part of the
	// module (regardless of whether the processing was successful).
	NumPackages *int
}

ModuleVersionState holds a worker module version state.

type Modver

type Modver struct {
	Path    string
	Version string
}

A Modver holds a module path and version.

func ParseModver

func ParseModver(s string) (mv Modver, err error)

ParseModver parses a string of the form M@V into a Modver.

func (Modver) String

func (mv Modver) String() string

type PackageMeta

type PackageMeta struct {
	Path              string
	Name              string
	Synopsis          string
	IsRedistributable bool
	Licenses          []*licenses.Metadata // metadata of applicable licenses
}

PackageMeta represents the metadata of a package in a module version.

func (*PackageMeta) RemoveNonRedistributableData

func (p *PackageMeta) RemoveNonRedistributableData()

type PackageVersionState

type PackageVersionState struct {
	PackagePath string
	ModulePath  string
	Version     string
	Status      int
	Error       string
}

PackageVersionState holds a worker package version state. It is associated with a given module version state.

type PostgresDB

type PostgresDB interface {
	DataSource

	IsExcluded(ctx context.Context, path, version string) bool
	GetImportedBy(ctx context.Context, pkgPath, modulePath string, limit int) (paths []string, err error)
	GetImportedByCount(ctx context.Context, pkgPath, modulePath string) (_ int, err error)
	GetLatestMajorPathForV1Path(ctx context.Context, v1path string) (_ string, _ int, err error)
	GetStdlibPathsWithSuffix(ctx context.Context, suffix string) (paths []string, err error)
	GetSymbolHistory(ctx context.Context, packagePath, modulePath string) (_ *SymbolHistory, err error)
	GetVersionMap(ctx context.Context, modulePath, requestedVersion string) (_ *VersionMap, err error)
	GetVersionMaps(ctx context.Context, paths []string, requestedVersion string) (_ []*VersionMap, err error)
	GetVersionsForPath(ctx context.Context, path string) (_ []*ModuleInfo, err error)
	InsertModule(ctx context.Context, m *Module, lmv *LatestModuleVersions) (isLatest bool, err error)
	UpsertVersionMap(ctx context.Context, vm *VersionMap) (err error)
}

PostgresDB provides an interface satisfied by *(internal/postgres.DB) so that packages in pkgsite can use the database if it exists without needing a dependency on the database driver packages.

type Readme

type Readme struct {
	Filepath string
	Contents string
}

Readme is a README at the specified filepath.

type RequestInfo

type RequestInfo struct {
	Request    *http.Request
	TrimmedURL string       // URL with the scheme and host removed
	TraceID    string       // extracted from request header
	Start      time.Time    // when the request began
	State      atomic.Value // string describing current state; see [RequestState]
	Cancel     func(error)  // function that cancels the request's context
}

RequestInfo is information about an HTTP request.

func NewRequestInfo

func NewRequestInfo(r *http.Request) *RequestInfo

func RequestInfoFromContext

func RequestInfoFromContext(ctx context.Context) *RequestInfo

RequestInfoFromContext retrieves the trace ID from the context, or a zero one if it isn't there.

type SearchOptions

type SearchOptions struct {
	// Maximum number of results to return (page size).
	MaxResults int

	// Offset for DB query.
	Offset int

	// Maximum number to use for total result count.
	MaxResultCount int

	// If true, perform a symbol search.
	SearchSymbols bool

	// SymbolFilter is the word in a search query with a # prefix.
	SymbolFilter string
}

SearchOptions provide information used by db.Search.

type SearchResult

type SearchResult struct {
	Name        string
	PackagePath string
	ModulePath  string
	Version     string
	Synopsis    string
	Licenses    []string

	CommitTime time.Time

	// Score is used to sort items in an array of SearchResult.
	Score float64

	// NumImportedBy is the number of packages that import PackagePath.
	NumImportedBy uint64

	// SameModule is a list of SearchResults from the same module as this one,
	// with lower scores.
	SameModule []*SearchResult

	// OtherMajor is a map from module paths with the same series path but at
	// different major versions of this module, to major version.
	// The major version for a non-vN module path (either 0 or 1) is computed
	// based on the version in search documents.
	OtherMajor map[string]int

	// NumResults is the total number of packages that were returned for this
	// search.
	NumResults uint64

	// Symbol information returned by a search request.
	// Only populated for symbol search mode.
	SymbolName     string
	SymbolKind     SymbolKind
	SymbolSynopsis string
	SymbolGOOS     string
	SymbolGOARCH   string

	// Offset is the 0-based number of this row in the DB query results, which
	// is the value to use in a SQL OFFSET clause to have this row be the first
	// one returned.
	Offset int
}

SearchResult represents a single search result from SearchDocuments.

type SearchSupport

type SearchSupport int
const (
	NoSearch    SearchSupport = iota
	BasicSearch               // package search only
	FullSearch                // all search modes supported
)

type Symbol

type Symbol struct {
	SymbolMeta

	// 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 []*SymbolMeta

	// GOOS specifies the execution operating system where the symbol appears.
	GOOS string

	// GOARCH specifies the execution architecture where the symbol appears.
	GOARCH string
}

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

type SymbolBuildContexts

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

SymbolBuildContexts represents the build contexts that are associated with a SymbolMeta.

func (*SymbolBuildContexts) AddBuildContext

func (us *SymbolBuildContexts) AddBuildContext(build BuildContext)

AddBuildContext adds a build context supported by this UnitSymbol.

func (*SymbolBuildContexts) BuildContexts

func (us *SymbolBuildContexts) BuildContexts() []BuildContext

BuildContexts returns the build contexts for this UnitSymbol.

func (*SymbolBuildContexts) InAll

func (us *SymbolBuildContexts) InAll() bool

InAll reports whether the unit symbol supports all build contexts.

func (*SymbolBuildContexts) RemoveBuildContexts

func (us *SymbolBuildContexts) RemoveBuildContexts()

RemoveBuildContexts removes all of the build contexts associated with this unit symbol.

func (*SymbolBuildContexts) SupportsBuild

func (us *SymbolBuildContexts) SupportsBuild(build BuildContext) bool

SupportsBuild reports whether the provided build is supported by this UnitSymbol. If the build is BuildContextAll, this is interpreted as this unit symbol supports at least one build context.

type SymbolHistory

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

SymbolHistory represents the history for when a symbol name was first added to a package.

func NewSymbolHistory

func NewSymbolHistory() *SymbolHistory

NewSymbolHistory returns a new *SymbolHistory.

func (*SymbolHistory) AddSymbol

func (sh *SymbolHistory) AddSymbol(sm SymbolMeta, v string, build BuildContext)

AddSymbol adds the given symbol to SymbolHistory.

func (*SymbolHistory) GetSymbol

func (sh *SymbolHistory) GetSymbol(name, v string, build BuildContext) (_ *SymbolMeta, err error)

GetSymbol returns the unit symbol for a given name, version and build context.

func (*SymbolHistory) SymbolsAtVersion

func (sh *SymbolHistory) SymbolsAtVersion(v string) map[string]map[SymbolMeta]*SymbolBuildContexts

SymbolsAtVersion returns a map of name to SymbolMeta to UnitSymbol for a given version.

func (*SymbolHistory) Versions

func (sh *SymbolHistory) Versions() []string

Versions returns an array of the versions in versionToNameToUnitSymbol, sorted by increasing semver.

type SymbolKind

type SymbolKind string

SymbolKind is the type of a symbol.

const (
	SymbolKindConstant SymbolKind = "Constant"
	SymbolKindVariable SymbolKind = "Variable"
	SymbolKindFunction SymbolKind = "Function"
	SymbolKindType     SymbolKind = "Type"
	SymbolKindField    SymbolKind = "Field"
	SymbolKindMethod   SymbolKind = "Method"
)

type SymbolMeta

type SymbolMeta struct {
	// Name is the name of the symbol.
	Name string

	// Synopsis is the one line description of the symbol as displayed
	// in the package documentation.
	Synopsis string

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

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

	// ParentName if name of the parent type if available, otherwise
	// the empty string. For example, the parent type for
	// net/http.FileServer is Handler.
	ParentName string
}

SymbolMeta is the metadata for an element in the package API. A symbol can be a constant, variable, function, or type.

type SymbolSection

type SymbolSection string

SymbolSection is the documentation section where a symbol appears.

const (
	SymbolSectionConstants SymbolSection = "Constants"
	SymbolSectionVariables SymbolSection = "Variables"
	SymbolSectionFunctions SymbolSection = "Functions"
	SymbolSectionTypes     SymbolSection = "Types"
)

type Unit

type Unit struct {
	UnitMeta
	Readme          *Readme
	BuildContexts   []BuildContext
	Documentation   []*Documentation // at most one on read
	Subdirectories  []*PackageMeta
	Imports         []string
	LicenseContents []*licenses.License
	Symbols         map[BuildContext][]*Symbol
	NumImports      int
	NumImportedBy   int
	Licenses        []*licenses.Metadata
	// Note: IsRedistributable applies to the unit;
	// UnitMeta.ModuleInfo.IsRedistributable applies to the module.
	IsRedistributable bool

	// SymbolHistory is a map of symbolName to the version when the symbol was
	// first added to the package.
	SymbolHistory map[string]string

	MainContent safehtml.HTML
}

Unit represents the contents of some path in the Go package/module namespace. It might be a module, a package, both a module and a package, or none of the above: a directory within a module that has no .go files, but contains other units, licenses and/or READMEs."

func (*Unit) RemoveNonRedistributableData

func (u *Unit) RemoveNonRedistributableData()

type UnitMeta

type UnitMeta struct {
	// Unit level information
	//
	Path string
	Name string

	// Module level information
	ModuleInfo
}

UnitMeta represents metadata about a unit.

func (*UnitMeta) IsCommand

func (um *UnitMeta) IsCommand() bool

IsCommand reports whether the path represents a main package path.

func (*UnitMeta) IsModule

func (um *UnitMeta) IsModule() bool

IsModule reports whether the path represents a module path.

func (*UnitMeta) IsPackage

func (um *UnitMeta) IsPackage() bool

IsPackage reports whether the path represents a package path.

type VersionMap

type VersionMap struct {
	ModulePath       string
	RequestedVersion string
	ResolvedVersion  string
	GoModPath        string
	Status           int
	Error            string
	UpdatedAt        time.Time
}

VersionMap holds metadata associated with module queries for a version.

Directories

Path Synopsis
Package auth authorizes programs to make HTTP requests to the discovery site.
Package auth authorizes programs to make HTTP requests to the discovery site.
Package browser provides utilities for interacting with users' browsers.
Package browser provides utilities for interacting with users' browsers.
Package cache implements a redis-based page cache for pkgsite.
Package cache implements a redis-based page cache for pkgsite.
Package config provides the definition of the configuration for the frontend.
Package config provides the definition of the configuration for the frontend.
dynconfig
Package dynconfig supports dynamic configuration for pkgsite services.
Package dynconfig supports dynamic configuration for pkgsite services.
serverconfig
Package serverconfig resolves shared configuration for Go Discovery services.
Package serverconfig resolves shared configuration for Go Discovery services.
Package cookie is used to get and set HTTP cookies.
Package cookie is used to get and set HTTP cookies.
Package database adds some useful functionality to a sql.DB.
Package database adds some useful functionality to a sql.DB.
Package dcensus provides functionality for debug instrumentation.
Package dcensus provides functionality for debug instrumentation.
Package derrors defines internal error values to categorize the different types error semantics we support.
Package derrors defines internal error values to categorize the different types error semantics we support.
Package experiment provides functionality for experiments.
Package experiment provides functionality for experiments.
Package fetch provides a way to fetch modules from a proxy.
Package fetch provides a way to fetch modules from a proxy.
Package fetchdatasource provides an internal.DataSource implementation that fetches modules (rather than reading them from a database).
Package fetchdatasource provides an internal.DataSource implementation that fetches modules (rather than reading them from a database).
Package frontend provides functionality for running the pkg.go.dev site.
Package frontend provides functionality for running the pkg.go.dev site.
client
Package client provides a client for interacting with the frontend.
Package client provides a client for interacting with the frontend.
page
Package page defines common fields shared by pages when rendering templages.
Package page defines common fields shared by pages when rendering templages.
serrors
serrors contains error types used by the server
serrors contains error types used by the server
urlinfo
Package urlinfo provides functions for extracting information out of url paths.
Package urlinfo provides functions for extracting information out of url paths.
Package godoc is for rendering Go documentation.
Package godoc is for rendering Go documentation.
codec
Package codec implements the general-purpose part of an encoder for Go values.
Package codec implements the general-purpose part of an encoder for Go values.
dochtml
Package dochtml renders Go package documentation into HTML.
Package dochtml renders Go package documentation into HTML.
dochtml/internal/render
Package render formats Go documentation as HTML.
Package render formats Go documentation as HTML.
internal/lazyregexp
Package lazyregexp is a thin wrapper over regexp, allowing the use of global regexp variables without forcing them to be compiled at init.
Package lazyregexp is a thin wrapper over regexp, allowing the use of global regexp variables without forcing them to be compiled at init.
Package index provides a client for communicating with the module index.
Package index provides a client for communicating with the module index.
Package licenses detects licenses and determines whether they are redistributable.
Package licenses detects licenses and determines whether they are redistributable.
log
Package log supports structured and unstructured logging with levels.
Package log supports structured and unstructured logging with levels.
stackdriverlogger
Package log supports structured and unstructured logging with levels to GCP stackdriver.
Package log supports structured and unstructured logging with levels to GCP stackdriver.
Package lru provides an LRU cache.
Package lru provides an LRU cache.
Package memory provides functions to collect memory information from a variety of places.
Package memory provides functions to collect memory information from a variety of places.
Package middleware implements a simple middleware pattern for http handlers, along with implementations for some common middlewares.
Package middleware implements a simple middleware pattern for http handlers, along with implementations for some common middlewares.
Package osv implements the Go OSV vulnerability format (https://go.dev/security/vuln/database#schema), which is a subset of the OSV shared vulnerability format (https://ossf.github.io/osv-schema), with database and ecosystem-specific meanings and fields.
Package osv implements the Go OSV vulnerability format (https://go.dev/security/vuln/database#schema), which is a subset of the OSV shared vulnerability format (https://ossf.github.io/osv-schema), with database and ecosystem-specific meanings and fields.
Package poller supports periodic polling to load a value.
Package poller supports periodic polling to load a value.
Package postgres provides functionality for reading and writing to the postgres database.
Package postgres provides functionality for reading and writing to the postgres database.
Package proxy provides a client for interacting with a proxy.
Package proxy provides a client for interacting with a proxy.
proxytest
Package proxytest supports testing with the proxy.
Package proxytest supports testing with the proxy.
Package queue provides a queue interface that can be used for asynchronous scheduling of fetch actions.
Package queue provides a queue interface that can be used for asynchronous scheduling of fetch actions.
gcpqueue
Package gcpqueue provides a GCP queue implementation that can be used for asynchronous scheduling of fetch actions.
Package gcpqueue provides a GCP queue implementation that can be used for asynchronous scheduling of fetch actions.
Package sanitizer provides a simple html sanitizer to remove tags and attributes that could potentially cause security issues.
Package sanitizer provides a simple html sanitizer to remove tags and attributes that could potentially cause security issues.
Package secrets is used to interact with secretmanager.
Package secrets is used to interact with secretmanager.
Package source constructs public URLs that link to the source files in a module.
Package source constructs public URLs that link to the source files in a module.
Package static builds static assets for the frontend and the worker.
Package static builds static assets for the frontend and the worker.
Package stdlib supports special handling of the Go standard library.
Package stdlib supports special handling of the Go standard library.
Package testenv provides information about what functionality is available in different testing environments run by the Go team.
Package testenv provides information about what functionality is available in different testing environments run by the Go team.
testing
fakedatasource
Package fakedatasource provides a fake implementation of the internal.DataSource interface.
Package fakedatasource provides a fake implementation of the internal.DataSource interface.
htmlcheck
Package htmlcheck provides a set of functions that check for properties of a parsed HTML document.
Package htmlcheck provides a set of functions that check for properties of a parsed HTML document.
pagecheck
Package pagecheck implements HTML checkers for discovery site pages.
Package pagecheck implements HTML checkers for discovery site pages.
sample
Package sample provides functionality for generating sample values of the types contained in the internal package.
Package sample provides functionality for generating sample values of the types contained in the internal package.
testhelper
Package testhelper provides shared functionality and constants to be used in Discovery tests.
Package testhelper provides shared functionality and constants to be used in Discovery tests.
package trace provides a wrapper around third party tracing libraries.
package trace provides a wrapper around third party tracing libraries.
Package version handles version types.
Package version handles version types.
Package vulns provides utilities to interact with vuln APIs.
Package vulns provides utilities to interact with vuln APIs.
Package worker provides functionality for running a worker service.
Package worker provides functionality for running a worker service.
Package xcontext is a package to offer the extra functionality we need from contexts that is not available from the standard context package.
Package xcontext is a package to offer the extra functionality we need from contexts that is not available from the standard context package.

Jump to

Keyboard shortcuts

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