pkgsite: Index | Files

package stdlib

import ""

Package stdlib supports special handling of the Go standard library. Regardless of the how the standard library has been split into modules for development and testing, the discovery site treats it as a single module named "std".


Package Files



const (
    GoRepoURL       = ""
    GoSourceRepoURL = ""
const ModulePath = "std"

ModulePath is the name of the module for the standard library.


var TestCommitTime = time.Date(2019, 9, 4, 1, 2, 3, 0, time.UTC)

TestCommitTime is the time used for all commits when UseTestData is true.

var UseTestData = false

UseTestData determines whether to really clone the Go repo, or use stripped-down versions of the repo from the testdata directory.

func Contains Uses

func Contains(path string) bool

Contains reports whether the given import path could be part of the Go standard library, by reporting whether the first component lacks a '.'.

func Directory Uses

func Directory(version string) string

Directory returns the directory of the standard library relative to the repo root.

func MajorVersionForVersion Uses

func MajorVersionForVersion(version string) (_ string, err error)

MajorVersionForVersion returns the Go major version for version. E.g. "v1.13.3" => "go1".

func TagForVersion Uses

func TagForVersion(version string) (_ string, err error)

TagForVersion returns the Go standard library repository tag corresponding to semver. The Go tags differ from standard semantic versions in a few ways, such as beginning with "go" instead of "v".

func VersionForTag Uses

func VersionForTag(tag string) string

VersionForTag returns the semantic version for the Go tag, or "" if tag doesn't correspond to a Go release or beta tag. Examples:

"go1" => "v1.0.0"
"go1.2" => "v1.2.0"
"go1.13beta1" => "v1.13.0-beta.1"
"go1.9rc2" => "v1.9.0-rc.2"

func Versions Uses

func Versions() (_ []string, err error)

Versions returns all the versions of Go that are relevant to the discovery site. These are all release versions (tags of the forms "goN.N" and "goN.N.N", where N is a number) and beta or rc versions (tags of the forms "goN.NbetaN" and "goN.N.NbetaN", and similarly for "rc" replacing "beta").

func Zip Uses

func Zip(requestedVersion string) (_ *zip.Reader, commitTime time.Time, _ string, err error)

Zip creates a module zip representing the entire Go standard library at the given version and returns a reader to it. It also returns the time of the commit for that version. The zip file is in module form, with each path prefixed by ModuleName + "@" + version. It also returns the resolved version.

Zip reads the standard library at the Go repository tag corresponding to to the given semantic version.

Zip ignores go.mod files in the standard library, treating it as if it were a single module named "std" at the given version.

Package stdlib imports 21 packages (graph) and is imported by 16 packages. Updated 2020-09-18. Refresh now. Tools for package owners.