Created
November 28, 2023 14:05
-
-
Save sitaramshelke/4151c828b6e7753bca7e73250a023c54 to your computer and use it in GitHub Desktop.
Snippet for self updatable go binaries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code snippet: Download the latest version | |
func downloadAssetFromID(assetId AssetId) (*bytes.Buffer, error) { | |
_, rdurl, err := githubClient.Repositories.DownloadReleaseAsset(context.Background(), "one2nc", "cloudlens", int64(assetId), nil) | |
resp, err := httpClient.Get(rdurl) | |
defer resp.Body.Close() | |
bin, err := io.ReadAll(resp.Body) | |
return bytes.NewBuffer(bin), nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment