Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor updater API #767

Merged
merged 6 commits into from
Feb 14, 2023
Merged

Refactor updater API #767

merged 6 commits into from
Feb 14, 2023

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Feb 10, 2023

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • Tests for the changes have been added (for bug fixes / features)
  • What kind of change does this PR introduce?
    This PR refactor the updater package, it aims to provide a more defined API for the autoupdate feature.
    The API defined here is composed of two function that the auto-updater should implement:
// Start checks if an update has been downloaded and if so returns the path to the
// binary to be executed to perform the update. If no update has been downloaded
// it returns an empty string.
func Start(src string) string {
	return start(src)
}

// CheckForUpdates checks if there is a new version of the binary available and
// if so downloads it.
func CheckForUpdates(currentVersion string, updateAPIURL, updateBinURL string, cmdName string) (string, error) {
	return checkForUpdates(currentVersion, updateAPIURL, updateBinURL, cmdName)
}

we can differentiate the auto-update procedure for different OS simply by implementing these two functions for each OS via go:build flags, as already demonstrated here for macos here (for now it's just an empty stub).

  • What is the current behavior?
    No changes
  • What is the new behavior?
  • Does this PR introduce a breaking change?
  • Other information:

@cmaglie cmaglie requested a review from umbynos February 10, 2023 16:51
@cmaglie cmaglie self-assigned this Feb 10, 2023
@cmaglie cmaglie added the type: enhancement Proposed improvement label Feb 10, 2023
@per1234 per1234 added the topic: code Related to content of the project itself label Feb 11, 2023
@umbynos umbynos linked an issue Feb 13, 2023 that may be closed by this pull request
2 tasks
@cmaglie cmaglie merged commit 6c9aec1 into main Feb 14, 2023
@cmaglie cmaglie deleted the refactor_updater branch February 14, 2023 09:42
@umbynos umbynos mentioned this pull request Feb 14, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rewrite the update logic to download and replace the app bundle
3 participants