Skip to content

Instantly share code, notes, and snippets.

@chazcheadle
Created September 15, 2016 03:58
Show Gist options
  • Select an option

  • Save chazcheadle/00b2746eeb21265c8c24e8f51aecc938 to your computer and use it in GitHub Desktop.

Select an option

Save chazcheadle/00b2746eeb21265c8c24e8f51aecc938 to your computer and use it in GitHub Desktop.
Golang go-github example to list a user's public repositories
package main
import (
"fmt"
"github.com/google/go-github/github"
)
func main() {
var user string
user = "chazcheadle"
client := github.NewClient(nil)
opt := &github.RepositoryListOptions{Type: "owner"}
repos, _, err := client.Repositories.List(user, opt)
if err != nil {
fmt.Println("Error retrieving repositories for %s", user)
}
fmt.Println("%v", repos)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment