File tree Expand file tree Collapse file tree 2 files changed +7
-13
lines changed
Expand file tree Collapse file tree 2 files changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -119,20 +119,17 @@ func GetReposData(username string, noOfRepos int) []ReposInfoJson {
119119 if err != nil {
120120 log .Fatal (err )
121121 }
122- searchResult := responseToRepoData (bodyJson ) //Unmarshall ReposJson to ReposInfoJsonArray .
122+ searchResult := responseToRepoData (bodyJson ) //Unmarshall ReposJson to []ReposInfoJson .
123123 result = append (result , searchResult ... ) //Append ReposJson after changing each Page query.
124124 }
125125 return result
126126}
127127
128- func Fetch (username string ) userCollection {
128+ func Fetch (username string ) [] byte {
129129 accountData := GetUserData (username )
130130 repoData := GetReposData (username , accountData .Public_repos )
131+ marshalToStruct := (userCollection {accountData , repoData })
131132
132- return (userCollection {accountData , repoData })
133- }
134-
135- func MarshalFetchData (data userCollection ) []byte {
136- accountByte , _ := json .MarshalIndent (data , " " , " " )
137- return accountByte
133+ resultByte , _ := json .MarshalIndent (marshalToStruct , " " , " " )
134+ return resultByte
138135}
Original file line number Diff line number Diff line change 99func sequence (usernames []string ) {
1010
1111 for _ , username := range usernames {
12- resultJson := githubapi .Fetch (username )
13- resultByte := githubapi .MarshalFetchData (resultJson )
12+ resultByte := githubapi .Fetch (username )
1413 io .WriteToFile (username , resultByte )
1514 }
1615}
@@ -36,9 +35,7 @@ func concurrently(usernames []string) {
3635
3736func conFetch (username string , dataToFile chan map [string ][]byte , wg * sync.WaitGroup ) {
3837
39- resultJson := githubapi .Fetch (username )
40- resultByte := githubapi .MarshalFetchData (resultJson )
41-
38+ resultByte := githubapi .Fetch (username )
4239 dataToChannel := make (map [string ][]byte )
4340 dataToChannel [username ] = resultByte
4441 dataToFile <- dataToChannel
You can’t perform that action at this time.
0 commit comments