renamed some variables in GetReposFromGitHub()
This commit is contained in:
parent
b08bed3618
commit
61a76e1a06
16
functions.go
16
functions.go
@ -80,12 +80,12 @@ func (config *Config) GetConfig() error {
|
||||
|
||||
// GetReposFromGitHub get starred repositories from github
|
||||
func GetReposFromGitHub(config *Config) ([]GitHubRepo, error) {
|
||||
var repolist []GitHubRepo
|
||||
var repo []GitHubRepo
|
||||
var repopartiallist []GitHubRepo
|
||||
var repofulllist []GitHubRepo
|
||||
|
||||
fmt.Println("Getting GitHub starred repos")
|
||||
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)
|
||||
|
||||
resp, err := InvokeGitHub(config, url)
|
||||
@ -98,17 +98,17 @@ func GetReposFromGitHub(config *Config) ([]GitHubRepo, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(*respbody, &repo)
|
||||
err = json.Unmarshal(*respbody, &repopartiallist)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, elem := range repo {
|
||||
repolist = append(repolist, elem)
|
||||
for _, elem := range repopartiallist {
|
||||
repofulllist = append(repofulllist, elem)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println(fmt.Sprintf("%d repositories from Github fetched", len(repolist)))
|
||||
return repolist, nil
|
||||
fmt.Println(fmt.Sprintf("%d repositories from Github fetched", len(repofulllist)))
|
||||
return repofulllist, nil
|
||||
}
|
||||
|
||||
// InvokeGitHub ...
|
||||
|
Loading…
Reference in New Issue
Block a user