Documentation
¶
Overview ¶
Package doctor diagnoses a gotools environment: the Go installation, the module proxy, the manifest, each managed tool, the lock, module integrity and disk use.
A Doctor only looks. It takes no lock (it asks who holds it), writes nothing, and runs every go probe with GOTOOLCHAIN=local so it never downloads a toolchain, from a scratch directory so go never reads a project's go.mod. What it finds is a Report of Check rows; a problem is a row with status warn or fail, never an error, so a caller can always render a full report.
Index ¶
Constants ¶
const DefaultProxyTimeout = 5 * time.Second
DefaultProxyTimeout bounds the reachability probe.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Check ¶
type Check struct {
Name string `json:"name"`
Status Status `json:"status"`
Detail string `json:"detail,omitempty"`
}
Check is one row of a report. Names are dotted: the part before the dot is the group the row belongs to.
type Doctor ¶
type Doctor struct {
Program string // the command name used in the advice, e.g. "gotools"
Root string
Layout strategy.Layout
Manifest *manifest.Manifest
// HasManifest reports whether the manifest file exists.
HasManifest bool
// Bad says why the manifest could not be loaded, "" when it could.
Bad string
ModFiles modparser.Parser
Locker lock.Locker
Go gocmd.Runner
// Offline turns the proxy check off and every probe's proxy to "off".
Offline bool
// Scratch is an empty directory go is run from.
Scratch string
// LookGo finds the go binary for the report; exec.LookPath("go") when nil.
LookGo func() (string, error)
// ProxyTimeout bounds the reachability probe; DefaultProxyTimeout when zero.
ProxyTimeout time.Duration
// contains filtered or unexported fields
}
Doctor runs the checks for one project. Everything it touches is a field, so a test supplies a fake go runner and a directory of files.