The markdown and repo list examples are pretty simple and can easily be moved to be inline samples so that they render as part of the packages godocs. This helps make them more visible even if they won't run in the browser. The basic auth example requires interacting with the user, so leaving it where it is. Future examples should be included inline whenever possible.
| @ -1,24 +0,0 @@ | |||||
| // Copyright 2014 The go-github AUTHORS. All rights reserved. | |||||
| // | |||||
| // Use of this source code is governed by a BSD-style | |||||
| // license that can be found in the LICENSE file. | |||||
| package main | |||||
| import ( | |||||
| "fmt" | |||||
| "github.com/google/go-github/github" | |||||
| ) | |||||
| func main() { | |||||
| client := github.NewClient(nil) | |||||
| input := "# heading #\nLink to issue #1\n" | |||||
| md, _, err := client.Markdown(input, &github.MarkdownOptions{Mode: "gfm", Context: "google/go-github"}) | |||||
| if err != nil { | |||||
| fmt.Printf("error: %v\n\n", err) | |||||
| } | |||||
| fmt.Printf("converted markdown:\n%v\n", md) | |||||
| } | |||||
| @ -1,33 +0,0 @@ | |||||
| // Copyright 2013 The go-github AUTHORS. All rights reserved. | |||||
| // | |||||
| // Use of this source code is governed by a BSD-style | |||||
| // license that can be found in the LICENSE file. | |||||
| package main | |||||
| import ( | |||||
| "fmt" | |||||
| "github.com/google/go-github/github" | |||||
| ) | |||||
| func main() { | |||||
| client := github.NewClient(nil) | |||||
| fmt.Println("Recently updated repositories owned by user willnorris:") | |||||
| opt := &github.RepositoryListOptions{Type: "owner", Sort: "updated", Direction: "desc"} | |||||
| repos, _, err := client.Repositories.List("willnorris", opt) | |||||
| if err != nil { | |||||
| fmt.Printf("error: %v\n\n", err) | |||||
| } else { | |||||
| fmt.Printf("%v\n\n", github.Stringify(repos)) | |||||
| } | |||||
| rate, _, err := client.RateLimits() | |||||
| if err != nil { | |||||
| fmt.Printf("Error fetching rate limit: %#v\n\n", err) | |||||
| } else { | |||||
| fmt.Printf("API Rate Limit: %#v\n\n", rate) | |||||
| } | |||||
| } | |||||