()
| 20 | ) |
| 21 | |
| 22 | func main() { |
| 23 | fmt.Print("GitHub Token: ") |
| 24 | token, _ := term.ReadPassword(int(os.Stdin.Fd())) |
| 25 | fmt.Println() |
| 26 | |
| 27 | ctx := context.Background() |
| 28 | client, err := github.NewClient(github.WithAuthToken(string(token))) |
| 29 | if err != nil { |
| 30 | log.Fatalf("Error creating GitHub client: %v", err) |
| 31 | } |
| 32 | |
| 33 | user, resp, err := client.Users.Get(ctx, "") |
| 34 | if err != nil { |
| 35 | log.Fatalf("Error fetching user: %v", err) |
| 36 | } |
| 37 | |
| 38 | // Rate.Limit should most likely be 5000 when authorized. |
| 39 | log.Printf("Rate: %#v\n", resp.Rate) |
| 40 | |
| 41 | // If a Token Expiration has been set, it will be displayed. |
| 42 | if !resp.TokenExpiration.IsZero() { |
| 43 | log.Printf("Token Expiration: %v\n", resp.TokenExpiration) |
| 44 | } |
| 45 | |
| 46 | fmt.Printf("\n%v\n", github.Stringify(user)) |
| 47 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…