Skip to content

Instantly share code, notes, and snippets.

Last active May 26, 2019 11:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
requires passing in of "user" parameter, example: `go run main.go -user=davidobrien1985`
package main
import (
var (
userPtr = flag.String("user", "", "This is the user name whose repos you like to scan. The URL looks like<user>.")
type Repos struct {
Name string `json:"name"`
FullName string `json:"full_name"`
func main() {
baseURL := ""
getRepoNames(*userPtr, baseURL)
func getRepoNames(username string, url string) {
repoURL := url + "/users/" + username + "/repos"
res, err := http.Get(repoURL)
if err != nil {
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
// fmt.Print(string(body))
var u []Repos
json.Unmarshal(body, &u)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment