Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ReleaseInfoTimeout sets the HTTP client timeout for fetching release info. ReleaseInfoTimeout = time.Second * 1 // Release is the GitHub API URL template to fetch the latest release of a repository. Release = "https://api.github.com/repos/%s/releases/latest" )
Functions ¶
func IsCurrentLatest ¶
IsCurrentLatest compares the current version with the latest version.
Parameters:
- currVersion: The current version string.
- latestVersion: The latest version string.
Returns:
- true if the current version is greater than or equal to the latest version.
- An error if version parsing fails.
func UpdateNotice ¶
UpdateNotice generates a notice message if a newer version is available.
Parameters:
- currentVersion: The current version string.
- githubRepo: The GitHub repository in the format "owner/repo".
Returns:
- A string message prompting the user to update if a newer version is available.
- An empty string if there are no updates or if any errors occur.
Types ¶
type Info ¶
type Info struct {
Version string // Version of the release
TarURL string // Tarball URL of the release
}
Info holds information about a software release.
func ReleaseInfo ¶
ReleaseInfo fetches details related to the latest release from the provided URL.
Parameters:
- releaseURL: The URL to fetch the latest release information from. Example: "https://api.github.com/repos/raystack/optimus/releases/latest"
Returns:
- An *Info struct containing the version and tarball URL.
- An error if the HTTP request or response parsing fails.
Click to show internal directories.
Click to hide internal directories.