Skip to content

Instantly share code, notes, and snippets.

@sitaramshelke
Created November 28, 2023 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sitaramshelke/037988c1acfb69ed6904e307a5638514 to your computer and use it in GitHub Desktop.
Save sitaramshelke/037988c1acfb69ed6904e307a5638514 to your computer and use it in GitHub Desktop.
Snippet for self updatable go binaries
// Code snippet: Apply the self-update
bin, err := getExecutableFromAsset(assetId, format)
if err != nil {
// Handle error - can't get executable
}
updateOpts := selfupdate.Options{}
if err = selfupdate.Apply(bytes.NewBuffer(bin), updateOpts); err != nil {
// Handle error - update failed, roll back if necessary
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment