Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Version = "dev" Commit = "unknown" Date = "unknown" BuiltBy = "unknown" GoVersion = runtime.Version() Platform = fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH) )
Build information set by ldflags
Functions ¶
Types ¶
type GitHubRelease ¶
type GitHubRelease struct {
TagName string `json:"tag_name"`
Name string `json:"name"`
Body string `json:"body"`
Draft bool `json:"draft"`
Prerelease bool `json:"prerelease"`
PublishedAt time.Time `json:"published_at"`
HTMLURL string `json:"html_url"`
}
GitHubRelease represents a GitHub release
type Info ¶
type Info struct {
Version string `json:"version"`
Commit string `json:"commit"`
Date string `json:"date"`
BuiltBy string `json:"built_by"`
GoVersion string `json:"go_version"`
Platform string `json:"platform"`
}
Info contains version information
type SelfUpdater ¶
type SelfUpdater struct {
// Repository is the GitHub repository
Repository string
// HTTPClient is the HTTP client to use
HTTPClient *http.Client
// Platform is the target platform
Platform string
// Architecture is the target architecture
Architecture string
}
SelfUpdater handles self-updating the binary
func NewSelfUpdater ¶
func NewSelfUpdater(repository string) *SelfUpdater
NewSelfUpdater creates a new self-updater
type UpdateChecker ¶
type UpdateChecker struct {
// CurrentVersion is the current version
CurrentVersion string
// Repository is the GitHub repository (e.g., "user/gh-notif")
Repository string
// HTTPClient is the HTTP client to use
HTTPClient *http.Client
// CheckInterval is how often to check for updates
CheckInterval time.Duration
// LastCheck is when we last checked for updates
LastCheck time.Time
}
UpdateChecker checks for updates
func NewUpdateChecker ¶
func NewUpdateChecker(repository string) *UpdateChecker
NewUpdateChecker creates a new update checker
func (*UpdateChecker) CheckForUpdate ¶
func (uc *UpdateChecker) CheckForUpdate(ctx context.Context) (*UpdateInfo, error)
CheckForUpdate checks for a newer version
type UpdateInfo ¶
type UpdateInfo struct {
CurrentVersion string `json:"current_version"`
LatestVersion string `json:"latest_version"`
ReleaseURL string `json:"release_url"`
ReleaseNotes string `json:"release_notes"`
PublishedAt time.Time `json:"published_at"`
}
UpdateInfo contains information about an available update
func (*UpdateInfo) String ¶
func (ui *UpdateInfo) String() string
String returns a formatted update message
Click to show internal directories.
Click to hide internal directories.