package source

Import Path
	golang.org/x/pkgsite/internal/source (on go.dev)

Dependency Relation
	imports 18 packages, and imported by 10 packages

Involved Source Files meta-tags.go Package source constructs public URLs that link to the source files in a module. It can be used to build references to Go source code, or to any other files in a module. Of course, the module zip file contains all the files in the module. This package attempts to find the origin of the zip file, in a repository that is publicly readable, and constructs links to that repo. While a module zip file could in theory come from anywhere, including a non-public location, this package recognizes standard module path patterns and construct repository URLs from them, like the go command does.
Package-Level Type Names (total 6, in which 2 are exported)
/* sort exporteds by: | */
func NewClient(timeout time.Duration) *Client func NewClientForTesting() *Client func ModuleInfo(ctx context.Context, client *Client, modulePath, version string) (info *Info, err error) func golang.org/x/pkgsite/internal/fetch.FetchLocalModule(ctx context.Context, modulePath, localPath string, sourceClient *Client) *fetch.FetchResult func golang.org/x/pkgsite/internal/fetch.FetchModule(ctx context.Context, modulePath, requestedVersion string, proxyClient *proxy.Client, sourceClient *Client) (fr *fetch.FetchResult) func golang.org/x/pkgsite/internal/frontend.FetchAndUpdateState(ctx context.Context, modulePath, requestedVersion string, proxyClient *proxy.Client, sourceClient *Client, db *postgres.DB) (_ int, err error)
Info holds source information about a module, used to generate URLs referring to directories, files and lines. DirectoryURL returns a URL for a directory relative to the module's home directory. FileURL returns a URL for a file whose pathname is relative to the module's home directory. LineURL returns a URL referring to a line in a file relative to the module's home directory. ToJSONForDB returns the Info encoded for storage in the database. ModuleURL returns a URL for the home page of the module. RawURL returns a URL referring to the raw contents of a file relative to the module's home directory. RepoURL returns a URL for the home page of the repository. (*T) UnmarshalJSON(data []byte) (err error) *T : encoding/json.Marshaler *T : encoding/json.Unmarshaler func ModuleInfo(ctx context.Context, client *Client, modulePath, version string) (info *Info, err error) func NewGitHubInfo(repoURL, moduleDir, commit string) *Info func NewStdlibInfo(version string) *Info func golang.org/x/pkgsite/internal/godoc.(*Package).DocInfo(ctx context.Context, innerPath string, sourceInfo *Info, modInfo *godoc.ModuleInfo) (synopsis string, imports []string, api []*internal.Symbol, err error) func golang.org/x/pkgsite/internal/godoc.(*Package).Render(ctx context.Context, innerPath string, sourceInfo *Info, modInfo *godoc.ModuleInfo, nameToVersion map[string]string) (_ *dochtml.Parts, err error)
Package-Level Functions (total 21, in which 5 are exported)
ModuleInfo determines the repository corresponding to the module path. It returns a URL to that repo, as well as the directory of the module relative to the repo root. ModuleInfo may fetch from arbitrary URLs, so it can be slow.
New constructs a *Client using the provided timeout.
NewClientForTesting returns a Client suitable for testing. It returns the same results as an ordinary client for statically recognizable paths, but always returns a nil *Info for dynamic paths (those requiring HTTP requests).
NewGitHubInfo creates a source.Info with GitHub URL templates. It is for testing only.
NewStdlibInfo returns a source.Info for the standard library at the given semantic version. It panics if the version does not correspond to a Go release tag. It is for testing only.
Package-Level Variables (total 10, none are exported)