update

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RepoOwner            = "avivsinai"
	RepoName             = "agent-message-queue"
	RepoSlug             = RepoOwner + "/" + RepoName
	BinaryName           = "amq"
	ChecksumsFilename    = "checksums.txt"
	DefaultCheckInterval = 24 * time.Hour
	EnvNoUpdateCheck     = "AMQ_NO_UPDATE_CHECK"
)

Variables

View Source
var (
	ErrUnsupportedOS   = errors.New("unsupported operating system")
	ErrUnsupportedArch = errors.New("unsupported architecture")
)

Functions

func AssetName

func AssetName(tag, goos, goarch string) (string, error)

func CompareVersions

func CompareVersions(current, latest string) (int, bool)

func DefaultCachePath

func DefaultCachePath() (string, error)

func DownloadReleaseAsset

func DownloadReleaseAsset(ctx context.Context, client *http.Client, tag, assetName, destPath string) error

func ExecutablePath

func ExecutablePath() (string, string, error)

func ExtractBinaryFromTarGz

func ExtractBinaryFromTarGz(archivePath, destDir string) (string, error)

func ExtractBinaryFromZip

func ExtractBinaryFromZip(archivePath, destDir string) (string, error)

func FetchChecksums

func FetchChecksums(ctx context.Context, client *http.Client, tag string) (map[string]string, error)

func FetchLatestTag

func FetchLatestTag(ctx context.Context, client *http.Client) (string, error)

func IsNoUpdateCheckEnv

func IsNoUpdateCheckEnv() bool

func IsUpdateAvailable

func IsUpdateAvailable(current, latest string) bool

func NormalizeVersion

func NormalizeVersion(version string) string

func ParseChecksums

func ParseChecksums(data []byte) (map[string]string, error)

func ReplaceBinary

func ReplaceBinary(srcPath, destPath string) (bool, error)

func SaveCache

func SaveCache(path string, cache *Cache) error

func VerifySHA256

func VerifySHA256(path, expected string) error

Types

type Cache

type Cache struct {
	CheckedAt     time.Time `json:"checked_at"`
	LatestVersion string    `json:"latest_version"`
}

func LoadCache

func LoadCache(path string) (*Cache, error)

type Notifier

type Notifier struct {
	CurrentVersion string
	NoCheck        bool
	Stderr         io.Writer
	Now            func() time.Time
	Client         *http.Client
	CachePath      string
	CheckInterval  time.Duration
}

func (Notifier) Start

func (n Notifier) Start(ctx context.Context)

Jump to

Keyboard shortcuts

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