renamed some variables in GetReposFromGitHub()

This commit is contained in:
Paul 2019-07-23 22:02:18 +02:00
parent b08bed3618
commit 61a76e1a06

View File

@ -80,12 +80,12 @@ func (config *Config) GetConfig() error {
// GetReposFromGitHub get starred repositories from github // GetReposFromGitHub get starred repositories from github
func GetReposFromGitHub(config *Config) ([]GitHubRepo, error) { func GetReposFromGitHub(config *Config) ([]GitHubRepo, error) {
var repolist []GitHubRepo var repopartiallist []GitHubRepo
var repo []GitHubRepo var repofulllist []GitHubRepo
fmt.Println("Getting GitHub starred repos") fmt.Println("Getting GitHub starred repos")
for num := 1; num <= config.githubconfig.PageNum; num++ { for num := 1; num <= config.githubconfig.PageNum; num++ {
url := fmt.Sprintf("https://api.github.com/users/%s/starred?per_page=%d&page=%d", config.githubconfig.AuthUsername, config.githubconfig.MaxPerPage, num) url := fmt.Sprintf("https://api.github.com/users/%s/starred?per_page=%d&page=%d", config.githubconfig.AuthUsername, config.githubconfig.MaxPerPage, num)
fmt.Println(url) fmt.Println(url)
resp, err := InvokeGitHub(config, url) resp, err := InvokeGitHub(config, url)
@ -98,17 +98,17 @@ func GetReposFromGitHub(config *Config) ([]GitHubRepo, error) {
return nil, err return nil, err
} }
err = json.Unmarshal(*respbody, &repo) err = json.Unmarshal(*respbody, &repopartiallist)
if err != nil { if err != nil {
return nil, err return nil, err
} }
for _, elem := range repo { for _, elem := range repopartiallist {
repolist = append(repolist, elem) repofulllist = append(repofulllist, elem)
} }
} }
fmt.Println(fmt.Sprintf("%d repositories from Github fetched", len(repolist))) fmt.Println(fmt.Sprintf("%d repositories from Github fetched", len(repofulllist)))
return repolist, nil return repofulllist, nil
} }
// InvokeGitHub ... // InvokeGitHub ...