doctor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package doctor checks that the stack is ready to run and says how to fix what isn't.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Inputs

type Inputs struct {
	Cfg      config.Config
	Profiles []profile.Profile
	Sys      System
}

Inputs is the user's configuration plus the system.

type Level

type Level int

Level is the severity of a result.

const (
	OK Level = iota
	Warn
	Fail
)

func Worst

func Worst(rs []Result) Level

Worst returns the most severe level in rs.

func (Level) String

func (l Level) String() string

type Result

type Result struct {
	Name   string
	Level  Level
	Detail string
	Fix    string // what to do, when Level != OK
}

Result is one check's outcome.

func Run

func Run(in Inputs) []Result

Run performs every check.

type System

type System struct {
	SystemdErr    error // nil if a systemd user session works
	LookPath      func(bin string) (string, error)
	Glob          func(pattern string) ([]string, error)
	Cards         func() []string           // ALSA card ids
	Access        func(path string) error   // nil if the current user can read and write path
	Group         func(path string) string  // owning group name of path
	Listening     func(port int) bool       // something accepts TCP on 127.0.0.1:port
	ServiceActive func(service string) bool // "rigctld@hf", "mercury@hf" or "pat"
	FileExists    func(path string) bool
	UnitsState    func() (installed, current bool) // unit files present / identical to what install would write
	RigModels     func() (map[int]string, error)   // radio models the installed hamlib supports (model -> driver status)
	HamlibVersion func() string
	SerialGroup   func() string // group that owns USB serial ports on this system
	GroupAdvice   func(name string) (exists bool, problem, fix string)
	PatLocator    func() (string, bool)                       // the locator in the active station's Pat config
	SiteHint      func() (site, why string, ok bool)          // another site whose radios are the ones plugged in
	PatHFPort     func() (port int, ok bool)                  // the VARA HF modem port the active station's Pat config points at
	PatPacketPort func() (port int, ok bool)                  // the AGWPE (Direwolf) port that Pat config uses for AX.25
	AnyEnabled    func() bool                                 // at least one hamstack service is set to start at login
	Linger        func() (bool, error)                        // user services run without a login session (start at boot)
	GPSDPath      func() (string, error)                      // where gpsd is installed (it lives in /usr/sbin on Debian)
	GPSDevice     func() (string, error)                      // the GPS receiver hamstack's gpsd would open, found right now
	SystemGPSD    func() string                               // the system-wide gpsd unit that is running, if any
	GPSFix        func() (fix bool, detail string, err error) // ask gpsd for a position (short wait)
}

System is everything the checks look at. Tests substitute fakes.

Jump to

Keyboard shortcuts

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