doctor

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package doctor provides a diagnostic command that validates configuration, checks environment health, and reports runtime details.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmdDoctor

func NewCmdDoctor(props *p.Props) *setup.Command

NewCmdDoctor creates the doctor command.

func NewCmdReport added in v0.22.0

func NewCmdReport(props *p.Props) *cobra.Command

NewCmdReport returns the `doctor report` subcommand: it prints a single, secret-redacted, paste-ready support bundle. It is gated implicitly by being a child of the DoctorCmd-gated `doctor` command.

func PrintBundle added in v0.22.0

func PrintBundle(w io.Writer, b *SupportBundle)

PrintBundle renders the human-readable bundle: a header, then labelled sections, reusing PrintReport for the checks for visual consistency.

func PrintReport

func PrintReport(w io.Writer, report *DoctorReport)

PrintReport writes a human-readable report to the given writer.

Types

type CheckFunc

type CheckFunc = setup.CheckFunc

CheckFunc is an alias for the registry's CheckFunc type.

func DefaultChecks

func DefaultChecks() []CheckFunc

DefaultChecks returns the standard set of diagnostic checks.

type CheckResult

type CheckResult = setup.CheckResult

CheckResult is an alias for the registry's CheckResult type.

type CheckStatus

type CheckStatus = string

CheckStatus is the outcome of a diagnostic check.

const (
	CheckPass CheckStatus = "pass"
	CheckWarn CheckStatus = "warn"
	CheckFail CheckStatus = "fail"
	CheckSkip CheckStatus = "skip"
)

type DoctorReport

type DoctorReport struct {
	Tool    string        `json:"tool"`
	Version string        `json:"version"`
	Checks  []CheckResult `json:"checks"`
}

DoctorReport contains all check results.

func RunChecks

func RunChecks(ctx context.Context, props *p.Props) *DoctorReport

RunChecks executes all diagnostic checks and returns a report.

type FeatureFlag added in v0.22.0

type FeatureFlag struct {
	Cmd     p.FeatureCmd `json:"cmd"`
	Enabled bool         `json:"enabled"`
}

FeatureFlag is one built-in feature's enabled/disabled state.

type PathsSection added in v0.22.0

type PathsSection struct {
	ConfigDir  string `json:"config_dir,omitempty"`
	ConfigFile string `json:"config_file,omitempty"`
}

PathsSection holds the resolved config locations (no cache dir — GTB has no cache subsystem).

type RuntimeSection added in v0.22.0

type RuntimeSection struct {
	Go   string `json:"go"`
	OS   string `json:"os"`
	Arch string `json:"arch"`
}

RuntimeSection holds the Go runtime and host OS/arch.

type SupportBundle added in v0.22.0

type SupportBundle struct {
	Tool     ToolSection    `json:"tool"`
	Runtime  RuntimeSection `json:"runtime"`
	Paths    PathsSection   `json:"paths"`
	Features []FeatureFlag  `json:"features"`
	Config   map[string]any `json:"config"` // redacted, key-name-preserving
	Doctor   *DoctorReport  `json:"doctor,omitempty"`
}

SupportBundle is the fully-collected, already-redacted output of `doctor report`. Every string field and every value in Config has passed through pkg/redact before CollectBundle returns it. It subsumes a plain `doctor` run by embedding the DoctorReport.

func CollectBundle added in v0.22.0

func CollectBundle(ctx context.Context, props *p.Props) *SupportBundle

CollectBundle gathers the support bundle and applies the redaction perimeter. It is total: nil Config or nil Version yield empty/omitted sections, never a panic.

type ToolSection added in v0.22.0

type ToolSection struct {
	Name    string `json:"name"`
	Summary string `json:"summary,omitempty"`
	Version string `json:"version"`
	Commit  string `json:"commit,omitempty"`
	Date    string `json:"date,omitempty"`
}

ToolSection holds the tool's identity and build metadata.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL