mirror of
https://github.com/avelino/awesome-go.git
synced 2024-11-07 16:33:40 +00:00
return map of repos
This commit is contained in:
parent
105035402b
commit
07df6adfbc
@ -123,7 +123,7 @@ func createIssue(t *testing.T, staleRepos []string, client *http.Client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: remove pointer from map
|
// FIXME: remove pointer from map
|
||||||
func getAllFlaggedRepositories(t *testing.T, client *http.Client, flaggedRepositories *map[string]bool) error {
|
func getAllFlaggedRepositories(t *testing.T, client *http.Client) map[string]bool {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
// FIXME: replace to http.MethodGet
|
// FIXME: replace to http.MethodGet
|
||||||
@ -138,6 +138,7 @@ func getAllFlaggedRepositories(t *testing.T, client *http.Client, flaggedReposit
|
|||||||
var issues []issue
|
var issues []issue
|
||||||
requireNoErr(t, json.NewDecoder(res.Body).Decode(&issues), "failed to unmarshal response")
|
requireNoErr(t, json.NewDecoder(res.Body).Decode(&issues), "failed to unmarshal response")
|
||||||
|
|
||||||
|
addressedRepositories := make(map[string]bool)
|
||||||
for _, issue := range issues {
|
for _, issue := range issues {
|
||||||
if issue.Title != issueTitle {
|
if issue.Title != issueTitle {
|
||||||
continue
|
continue
|
||||||
@ -145,11 +146,11 @@ func getAllFlaggedRepositories(t *testing.T, client *http.Client, flaggedReposit
|
|||||||
|
|
||||||
repos := getRepositoriesFromBody(issue.Body)
|
repos := getRepositoriesFromBody(issue.Body)
|
||||||
for _, repo := range repos {
|
for _, repo := range repos {
|
||||||
(*flaggedRepositories)[repo] = true
|
addressedRepositories[repo] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return addressedRepositories
|
||||||
}
|
}
|
||||||
|
|
||||||
func containsOpenIssue(link string, openIssues map[string]bool) bool {
|
func containsOpenIssue(link string, openIssues map[string]bool) bool {
|
||||||
@ -169,11 +170,13 @@ func testRepoState(toRun bool, href string, client *http.Client, staleRepos *[]s
|
|||||||
log.Printf("Failed at repository %s\n", href)
|
log.Printf("Failed at repository %s\n", href)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed at repository %s\n", href)
|
log.Printf("Failed at repository %s\n", href)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
var repoResp repo
|
var repoResp repo
|
||||||
@ -269,10 +272,8 @@ func TestStaleRepository(t *testing.T) {
|
|||||||
client = oauth2.NewClient(context.Background(), tokenSource)
|
client = oauth2.NewClient(context.Background(), tokenSource)
|
||||||
}
|
}
|
||||||
|
|
||||||
addressedRepositories := make(map[string]bool)
|
|
||||||
// FIXME: return addressedRepositories, no need to pass
|
// FIXME: return addressedRepositories, no need to pass
|
||||||
err := getAllFlaggedRepositories(t, client, &addressedRepositories)
|
addressedRepositories := getAllFlaggedRepositories(t, client)
|
||||||
requireNoErr(t, err, "failed to get existing issues")
|
|
||||||
|
|
||||||
var staleRepos []string
|
var staleRepos []string
|
||||||
doc.
|
doc.
|
||||||
|
Loading…
Reference in New Issue
Block a user