common

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package common provides utility functions for the IDSEC CLI, including self-update functionality for checking and managing application versions using GitHub releases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyUpgrade added in v0.10.0

func ApplyUpgrade(rel *selfupdate.Release, cmdPath string) error

ApplyUpgrade replaces the executable at cmdPath with the binary packaged in the given release's asset.

This exists instead of selfupdate.Updater.UpdateTo because that method locates the payload inside the archive by matching the running executable's file name. Release archives package the binary as "idsec-<os>", so the match only succeeds for a binary still carrying its published name: an `idsec` installed through `go install`, a renamed download, or the Docker image would detect the new version and then fail to apply it. Selecting the payload by file mode instead keeps the upgrade working regardless of what the binary is called.

func GetSelfUpgrader

func GetSelfUpgrader() (*selfupdate.Updater, error)

GetSelfUpgrader creates and configures a GitHub self-updater instance.

func IsLatestVersion

func IsLatestVersion() (bool, *semver.Version, error)

IsLatestVersion checks if the current application version is the latest available, bounded by latestVersionCheckTimeout.

On timeout the function returns a non-nil error; callers using the established `if err == nil && !isLatest` pattern (e.g. CommonActionsExecution) silently treat the result as inconclusive, surfacing nothing to the user. The in-flight HTTP request is left to complete in the background and its result is discarded; this is a deliberate trade-off because the vendored selfupdate library does not expose a context for cancellation.

func UpgradeRepoSlug added in v0.10.0

func UpgradeRepoSlug() string

UpgradeRepoSlug returns the GitHub "owner/name" slug that release binaries are published to, for use as the repository argument of the self-updater's detection calls.

Types

This section is empty.

Directories

Path Synopsis
Package args provides command-line argument handling utilities for the IDSEC SDK.
Package args provides command-line argument handling utilities for the IDSEC SDK.
Package deprecation provides helpers for marking CLI commands and flags as deprecated without hiding them from Cobra/pflag help output.
Package deprecation provides helpers for marking CLI commands and flags as deprecated without hiding them from Cobra/pflag help output.

Jump to

Keyboard shortcuts

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