Documentation
¶
Index ¶
- Variables
- func CachePath(ctx context.Context, m module.Version, suffix string) (string, error)
- func Download(ctx context.Context, mod module.Version) (dir string, err error)
- func DownloadDir(ctx context.Context, m module.Version) (string, error)
- func DownloadZip(ctx context.Context, mod module.Version) (zipfile string, err error)
- func GoMod(ctx context.Context, path, rev string) ([]byte, error)
- func GoModFile(ctx context.Context, path, version string) (string, error)
- func GoModSum(ctx context.Context, path, version string) (string, error)
- func HaveSum(mod module.Version) bool
- func LegacyGoMod(modPath string) []byte
- func RemoveAll(dir string) error
- func Reset()
- func SideLock(ctx context.Context) (unlock func(), err error)
- func Sum(ctx context.Context, mod module.Version) string
- func TrimGoSum(keep map[module.Version]bool)
- func TryProxies(f func(proxy string) error) error
- func WriteGoSum(ctx context.Context, keep map[module.Version]bool, readonly bool) error
- type DownloadDirPartialError
- type Repo
- type RevInfo
- type Versions
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrGoSumDirty = errors.New("updates to go.sum needed, disabled by -mod=readonly")
View Source
var ErrToolchain = errors.New("internal error: invalid operation on toolchain module")
View Source
var GoSumFile string // path to go.sum; set by package modload
View Source
var HelpGoproxy = &base.Command{
UsageLine: "goproxy",
Short: "module proxy protocol",
Long: `
A Go module proxy is any web server that can respond to GET requests for
URLs of a specified form. The requests have no query parameters, so even
a site serving from a fixed file system (including a file:/// URL)
can be a module proxy.
For details on the GOPROXY protocol, see
https://golang.org/ref/mod#goproxy-protocol.
`,
}
View Source
var HelpModuleAuth = &base.Command{
UsageLine: "module-auth",
Short: "module authentication using go.sum",
Long: `
When the go command downloads a module zip file or go.mod file into the
module cache, it computes a cryptographic hash and compares it with a known
value to verify the file hasn't changed since it was first downloaded. Known
hashes are stored in a file in the module root directory named go.sum. Hashes
may also be downloaded from the checksum database depending on the values of
GOSUMDB, GOPRIVATE, and GONOSUMDB.
For details, see https://golang.org/ref/mod#authenticating.
`,
}
View Source
var HelpPrivate = &base.Command{
UsageLine: "private",
Short: "configuration for downloading non-public code",
Long: `
The go command defaults to downloading modules from the public Go module
mirror at proxy.golang.org. It also defaults to validating downloaded modules,
regardless of source, against the public Go checksum database at sum.golang.org.
These defaults work well for publicly available source code.
The GOPRIVATE environment variable controls which modules the go command
considers to be private (not available publicly) and should therefore not use
the proxy or checksum database. The variable is a comma-separated list of
glob patterns (in the syntax of Go's path.Match) of module path prefixes.
For example,
GOPRIVATE=*.corp.example.com,rsc.io/private
causes the go command to treat as private any module with a path prefix
matching either pattern, including git.corp.example.com/xyzzy, rsc.io/private,
and rsc.io/private/quux.
For fine-grained control over module download and validation, the GONOPROXY
and GONOSUMDB environment variables accept the same kind of glob list
and override GOPRIVATE for the specific decision of whether to use the proxy
and checksum database, respectively.
For example, if a company ran a module proxy serving private modules,
users would configure go using:
GOPRIVATE=*.corp.example.com
GOPROXY=proxy.example.com
GONOPROXY=none
The GOPRIVATE variable is also used to define the "public" and "private"
patterns for the GOVCS variable; see 'go help vcs'. For that usage,
GOPRIVATE applies even in GOPATH mode. In that case, it matches import paths
instead of module paths.
The 'go env -w' command (see 'go help env') can be used to set these variables
for future go command invocations.
For more details, see https://golang.org/ref/mod#private-modules.
`,
}
View Source
var WorkspaceGoSumFiles []string // path to module go.sums in workspace; set by package modload
Functions ¶
func Download ¶
Download downloads the specific module version to the local download cache and returns the name of the directory corresponding to the root of the module's file tree.