sudo

package
v0.6.327 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 4 Imported by: ? 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedGater

type CachedGater struct{}

CachedGater is a Gater that always acts as if sudo is cached (no prompt, no refresh). For tests.

func (CachedGater) Gate

type Gater

type Gater interface {
	Gate(t *terminal.Terminal, confirmer terminal.Confirmer, reason string, assumeYes bool) error
}

Gater gates execution on sudo availability; callers can use Default or inject a stub in tests.

var Default Gater = &systemGater{}

Default is the Gater used by commands. Tests may replace it with a stub.

type Status

type Status int

Status represents the current sudo/root status of the process.

const (
	// StatusRoot means the process is already running as root.
	StatusRoot Status = 0
	// StatusCached means the user has a valid sudo timestamp (no password needed).
	StatusCached Status = 1
	// StatusUncached means sudo will require a password prompt.
	StatusUncached Status = 2
)

Jump to

Keyboard shortcuts

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