github

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package github provides a client for checking GitHub releases and a file-based cache for update notifications.

Index

Constants

View Source
const (
	// RepoOwner is the GitHub organization that owns the panda repository.
	RepoOwner = "ethpandaops"

	// RepoName is the GitHub repository name.
	RepoName = "panda"
)

Variables

This section is empty.

Functions

func SaveCache

func SaveCache(cache *UpdateCache) error

SaveCache writes the cache to disk.

Types

type Asset

type Asset struct {
	Name               string `json:"name"`
	BrowserDownloadURL string `json:"browser_download_url"`
}

Asset represents a downloadable file attached to a release.

type Release

type Release struct {
	TagName string  `json:"tag_name"`
	HTMLURL string  `json:"html_url"`
	Assets  []Asset `json:"assets"`
}

Release represents a GitHub release.

func (*Release) ChecksumsAsset

func (r *Release) ChecksumsAsset() (*Asset, error)

ChecksumsAsset returns the checksums.txt asset from the release.

func (*Release) FindAsset

func (r *Release) FindAsset(goos, goarch, binaryName string) (*Asset, error)

FindAsset returns the binary asset for the given OS, architecture, and binary name. Asset names follow the goreleaser pattern: {binaryName}_{version}_{os}_{arch}.tar.gz

func (*Release) FindCurrentPlatformAsset

func (r *Release) FindCurrentPlatformAsset() (*Asset, error)

FindCurrentPlatformAsset returns the asset for the CLI binary matching the current runtime.

type ReleaseChecker

type ReleaseChecker struct {
	// contains filtered or unexported fields
}

ReleaseChecker fetches release information from the GitHub API.

func NewReleaseChecker

func NewReleaseChecker(owner, repo string) *ReleaseChecker

NewReleaseChecker creates a checker for the given GitHub owner/repo.

func (*ReleaseChecker) LatestRelease

func (r *ReleaseChecker) LatestRelease(ctx context.Context) (*Release, error)

LatestRelease fetches the most recent non-prerelease release.

type UpdateCache

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

UpdateCache stores the result of a GitHub release check.

func LoadCache

func LoadCache() (*UpdateCache, error)

LoadCache reads the cache from disk. Returns nil, nil if the file does not exist.

func (*UpdateCache) IsFresh

func (c *UpdateCache) IsFresh() bool

IsFresh returns true if the cache is younger than the TTL.

Jump to

Keyboard shortcuts

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