Help us shape the future of Go! Take the 2026 Go Developer Survey

net

package
v0.0.0-...-a3376f9 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitHub = iota + 1
	Others
)

Variables

This section is empty.

Functions

func CheckUpdates

func CheckUpdates(b models.Binaries, a ...string) (models.Binaries, error)

CheckUpdates Does four things:

1. Get the current version of the binary 2. Find the provider of the binary 3. Check for the new version of the binary 4. Compare the current version with the new version

func DownloadAndMoveFiles

func DownloadAndMoveFiles(b models.Binaries) error

DownloadAndMoveFiles downloads a release asset and installs it.

For an archive it does five things:

1. Download the file 2. Verify the file 3. Uncompress the file 4. Move the files to the install location 5. Verify the new binary

For a deb or rpm the download and checksum verification are the same, but steps 3 to 5 are replaced by handing the file to the host's package manager and then confirming the installed version.

func NeedsRoot

func NeedsRoot(b models.Binaries) bool

NeedsRoot reports whether installing or removing b requires root privileges.

func NeedsRootForRemoval

func NeedsRootForRemoval(b models.Binaries) bool

NeedsRootForRemoval reports whether uninstalling b requires root. Unlike NeedsRoot it reads the config directly, because an inactive binary never goes through the update check that resolves the install spec.

func PackageManagerName

func PackageManagerName(b models.Binaries) string

PackageManagerName returns the tool that would install b, for display in the dry-run summary. It returns an empty string when b is not a package install or when no suitable manager exists on this host.

func PackageToRemove

func PackageToRemove(b models.Binaries) (string, error)

PackageToRemove reports which package an inactive config would uninstall, for the --check and --dry-run summaries. An empty name with no error means nothing is installed.

func PrepareElevation

func PrepareElevation() error

PrepareElevation resolves how to become root, prompting for a password if that is the only available route. Call it once, from a point where a prompt is acceptable, before any concurrent installs start.

func RemoveInstalledFiles

func RemoveInstalledFiles(b models.Binaries) error

RemoveInstalledFiles deletes what a binary installed when its config is inactive and settings.deleteIfNotActive is set.

Removing the whole install location is unsafe when it is the shared "~/bin" directory, since other binaries' configs may install there too. In that case only the files this binary installed are removed; otherwise the entire install location directory is removed. A deb or rpm install is owned by the package manager, which knows every path it wrote; deleting InstallLocation would miss those files entirely, so such a config is uninstalled through the package manager instead.

func ResolvedInstallType

func ResolvedInstallType(b models.Binaries) models.PackageType

ResolvedInstallType returns the install type a config resolves to on this host, reading the download entry directly so it also works for a binary that has not been through the update check.

Types

This section is empty.

Jump to

Keyboard shortcuts

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