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".
const ( GoRepoURL = "https://go.googlesource.com/go" GoSourceRepoURL = "https://github.com/golang/go" )
const ModulePath = "std"
ModulePath is the name of the module for the standard library.
TestCommitTime is the time used for all commits when UseTestData is true.
UseTestData determines whether to really clone the Go repo, or use stripped-down versions of the repo from the testdata directory.
Contains reports whether the given import path could be part of the Go standard library, by reporting whether the first component lacks a '.'.
Directory returns the directory of the standard library relative to the repo root.
MajorVersionForVersion returns the Go major version for version. E.g. "v1.13.3" => "go1".
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".
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"
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").
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.