From 625df2fec3f05bb6294854ae0fb97b1a349983b4 Mon Sep 17 00:00:00 2001 From: Kirill Zhuravlev Date: Sun, 26 Feb 2023 01:14:29 +0100 Subject: [PATCH] handle error --- stale_repositories_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stale_repositories_test.go b/stale_repositories_test.go index bf54236d..a83ca7d7 100644 --- a/stale_repositories_test.go +++ b/stale_repositories_test.go @@ -237,7 +237,9 @@ func checkRepoCommitActivity(toRun bool, href string, client *http.Client) ([]st var respObj []map[string]interface{} // FIXME: handle error in all that cases - json.NewDecoder(resp.Body).Decode(&respObj) + if err := json.NewDecoder(resp.Body).Decode(&respObj); err != nil { + return nil, false + } var warnings []string var isRepoAdded bool @@ -296,7 +298,7 @@ func TestStaleRepository(t *testing.T) { log.Printf("%s non-github repo not currently handled", href) } - // FIXME: this is `or` expression. Probably we need `and`? + // FIXME: this is `or` expres24sion. Probably we need `and`? warnings, isRepoAdded := checkRepoAvailability(true, href, client) staleRepos = append(staleRepos, warnings...)