Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions example/tokenauth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
// license that can be found in the LICENSE file.

// The tokenauth command demonstrates using the oauth2.StaticTokenSource.
// You can test out a GitHub Personal Access Token using this simple example.
// You can generate them here: https://github.com/settings/tokens
package main

import (
"context"
"fmt"
"log"
"syscall"

"github.com/google/go-github/v35/github"
Expand All @@ -29,12 +32,14 @@ func main() {

client := github.NewClient(tc)

user, _, err := client.Users.Get(ctx, "")

user, resp, err := client.Users.Get(ctx, "")
if err != nil {
fmt.Printf("\nerror: %v\n", err)
return
}

// Rate.Limit should most likely be 5000 when authorized.
log.Printf("Rate: %#v", resp.Rate)

fmt.Printf("\n%v\n", github.Stringify(user))
}