plugins: restructure and add tests for pluginsctl/* calls

This commit is contained in:
Chaitanya Bankanhal
2020-08-20 23:31:38 +05:30
committed by Nick Craig-Wood
parent cf68e61f40
commit 09b79679cd
5 changed files with 547 additions and 404 deletions

View File

@@ -27,9 +27,12 @@ func GetLatestReleaseURL(fetchURL string) (string, string, int, error) {
}
results := gitHubRequest{}
if err := json.NewDecoder(resp.Body).Decode(&results); err != nil {
return "", "", 0, errors.New("Could not decode results from http request")
return "", "", 0, errors.New("could not decode results from http request")
}
if len(results.Assets) < 1 {
return "", "", 0, errors.New("could not find an asset in the release. " +
"check if asset was successfully added in github release assets")
}
res := results.Assets[0].BrowserDownloadURL
tag := results.TagName
size := results.Assets[0].Size