octokit/go-octokit — pull request #41 by catsby (2013-12-04 03:54:08+00:00)
Title: Add Netrc auth method

Adds ability to authenticate with netrc.

This is my first patch to anything Go, I would love feedback here. Seems bad that I have to import 4 packages to accomplish this. Also the test seems right to me but I'm not sure.

In writing this I found a lot of the [fields in the Users struct][1] don't contain data, particularly the `int` ones.

```go
//octo.go
package main

import (
"fmt"
"github.com/catsby/go-octokit/octokit"
)

func main() {
client := octokit.NewClient(octokit.NetrcAuth{})
fmt.Println("Client: ", client)
current_user_url, _ := octokit.CurrentUserURL.Expand(octokit.M{})
user_service := client.Users(current_user_url)
user, _ := user_service.One()
fmt.Println("followers: ", user.Followers)
fmt.Println("public gists: ", user.PublicGists)
}
```
Output:

```shell
go-octokit git:add_net_rc ❯ go run octo.go
Client: &{Octokit Go 0.3.0 Basic Y2F0c2**** map[]}
followers: 59
public gists: 0
```

I can file that as a separate bug if I'm not just doing something stupid.

[1]: https://github.com/octokit/go-octokit/blob/master/octokit/users.go#L44-L76