doctorng

package
v3.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package doctorng provides system diagnostics and dependency checking for Wails. It exposes a public API suitable for both CLI and GUI consumption.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildInfo

type BuildInfo struct {
	WailsVersion string            `json:"wails_version"`
	GoVersion    string            `json:"go_version"`
	BuildMode    string            `json:"build_mode,omitempty"`
	Compiler     string            `json:"compiler,omitempty"`
	CGOEnabled   bool              `json:"cgo_enabled"`
	Settings     map[string]string `json:"settings,omitempty"`
}

BuildInfo contains build environment information

type CPUInfo

type CPUInfo struct {
	Model string `json:"model"`
	Cores int    `json:"cores,omitempty"`
}

CPUInfo contains CPU details

type Dependency

type Dependency struct {
	// Name is the display name for this dependency
	Name string `json:"name"`

	// PackageName is the actual package name in the package manager
	PackageName string `json:"package_name,omitempty"`

	// Version is the installed version (empty if not installed)
	Version string `json:"version,omitempty"`

	// Status indicates the installation status
	Status Status `json:"status"`

	// Required indicates if this dependency is required (vs optional)
	Required bool `json:"required"`

	// InstallCommand is the command to install this dependency
	InstallCommand string `json:"install_command,omitempty"`

	// Description provides context about what this dependency is for
	Description string `json:"description,omitempty"`

	// Category groups related dependencies (e.g., "gtk", "build-tools")
	Category string `json:"category,omitempty"`
}

Dependency represents a system dependency

type DependencyList

type DependencyList []*Dependency

DependencyList is a collection of dependencies with helper methods

func (DependencyList) AllInstalled

func (d DependencyList) AllInstalled() bool

AllInstalled returns true if all required dependencies are installed

func (DependencyList) ByCategory

func (d DependencyList) ByCategory() map[string]DependencyList

ByCategory groups dependencies by their category

func (DependencyList) InstallCommands

func (d DependencyList) InstallCommands(requiredOnly bool) []string

InstallCommands returns install commands for all missing dependencies

func (DependencyList) OptionalMissing

func (d DependencyList) OptionalMissing() DependencyList

OptionalMissing returns all optional dependencies that are missing

func (DependencyList) RequiredMissing

func (d DependencyList) RequiredMissing() DependencyList

RequiredMissing returns all required dependencies that are missing

type DiagnosticResult

type DiagnosticResult struct {
	// Name is a short identifier for this diagnostic
	Name string `json:"name"`

	// Message describes the issue or status
	Message string `json:"message"`

	// Severity indicates how serious the issue is
	Severity DiagnosticSeverity `json:"severity"`

	// HelpURL points to documentation about this issue
	HelpURL string `json:"help_url,omitempty"`

	// Fix contains instructions or a command to fix the issue
	Fix *Fix `json:"fix,omitempty"`
}

DiagnosticResult represents the result of a diagnostic check

type DiagnosticSeverity

type DiagnosticSeverity int

DiagnosticSeverity indicates the severity of a diagnostic issue

const (
	SeverityInfo DiagnosticSeverity = iota
	SeverityWarning
	SeverityError
)

func (DiagnosticSeverity) String

func (s DiagnosticSeverity) String() string

type Doctor

type Doctor struct {
	// contains filtered or unexported fields
}

func New

func New() *Doctor

func (*Doctor) Run

func (d *Doctor) Run() (*Report, error)

type Fix

type Fix struct {
	// Description explains what the fix does
	Description string `json:"description"`

	// Command is a shell command that can be run to fix the issue
	// May be empty if manual intervention is required
	Command string `json:"command,omitempty"`

	// RequiresSudo indicates if the fix requires elevated privileges
	RequiresSudo bool `json:"requires_sudo,omitempty"`

	// ManualSteps are human-readable instructions if no command is available
	ManualSteps []string `json:"manual_steps,omitempty"`
}

Fix describes how to fix an issue

type GPUInfo

type GPUInfo struct {
	Name   string `json:"name"`
	Vendor string `json:"vendor,omitempty"`
	Driver string `json:"driver,omitempty"`
}

GPUInfo contains GPU details

type HardwareInfo

type HardwareInfo struct {
	CPUs   []CPUInfo `json:"cpus"`
	GPUs   []GPUInfo `json:"gpus"`
	Memory string    `json:"memory"`
}

HardwareInfo contains hardware details

type OSInfo

type OSInfo struct {
	Name     string `json:"name"`
	Version  string `json:"version"`
	ID       string `json:"id"`
	Branding string `json:"branding,omitempty"`
	Platform string `json:"platform"` // darwin, linux, windows
	Arch     string `json:"arch"`     // amd64, arm64, etc.
}

OSInfo contains operating system details

type Report

type Report struct {
	// Timestamp when the report was generated
	Timestamp time.Time `json:"timestamp"`

	// System information
	System SystemInfo `json:"system"`

	// Build environment
	Build BuildInfo `json:"build"`

	// Dependencies and their status
	Dependencies DependencyList `json:"dependencies"`

	// Diagnostic results (issues found)
	Diagnostics []DiagnosticResult `json:"diagnostics"`

	// Overall status
	Ready bool `json:"ready"`

	// Summary message
	Summary string `json:"summary"`
}

Report is the complete doctor report

func NewReport

func NewReport() *Report

NewReport creates a new empty report with the current timestamp

type Status

type Status int

Status represents the health status of a check

const (
	StatusUnknown Status = iota
	StatusOK
	StatusWarning
	StatusError
	StatusMissing
)

func (Status) MarshalJSON

func (s Status) MarshalJSON() ([]byte, error)

func (Status) String

func (s Status) String() string

type SystemInfo

type SystemInfo struct {
	// Operating system details
	OS OSInfo `json:"os"`

	// Hardware information
	Hardware HardwareInfo `json:"hardware"`

	// Environment variables relevant to Wails
	Environment map[string]string `json:"environment"`

	// Platform-specific extras (e.g., XDG_SESSION_TYPE on Linux)
	PlatformExtras map[string]string `json:"platform_extras,omitempty"`
}

SystemInfo contains information about the host system

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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