Documentation
¶
Index ¶
- Constants
- Variables
- func DetermineBinaryName(template string) (string, error)
- func RunRestartCommand(ctx context.Context, command string) (string, error)
- func UpdateFromGitHub(ctx context.Context, owner string, repo string, release ReleaseInfo, ...) (string, error)
- func UpdateFromURL(ctx context.Context, downloadURL string, binaryName string, ...) error
- type HTTPError
- type ReleaseAsset
- type ReleaseInfo
Constants ¶
const DefaultBinaryTemplate = "wings_{os}_{arch}"
Variables ¶
var ( // ErrUnsupportedArch indicates that the current runtime architecture is not supported. ErrUnsupportedArch = errors.New("selfupdate: unsupported architecture") // ErrChecksumNotFound indicates that the requested checksum could not be found in the checksum file. ErrChecksumNotFound = errors.New("selfupdate: checksum not found for binary") // ErrChecksumRequired indicates that a checksum must be supplied for direct downloads. ErrChecksumRequired = errors.New("selfupdate: checksum required for direct download") )
Functions ¶
func DetermineBinaryName ¶
DetermineBinaryName resolves the binary asset name using the provided template. The template may include placeholders "{arch}" (amd64/arm64) and "{os}" (runtime GOOS). When template is empty, a default value is used.
func RunRestartCommand ¶
RunRestartCommand executes the provided restart command using /bin/sh -c and returns combined output.
func UpdateFromGitHub ¶
func UpdateFromURL ¶
func UpdateFromURL(ctx context.Context, downloadURL string, binaryName string, expectedChecksum string, skipChecksum bool) error
UpdateFromURL downloads a binary from the specified URL and replaces the current binary. If expectedChecksum is provided it will be validated prior to replacing the binary unless skipChecksum is true.
Types ¶
type ReleaseAsset ¶
type ReleaseInfo ¶
type ReleaseInfo struct {
TagName string `json:"tag_name"`
Assets []ReleaseAsset `json:"assets"`
}