(token *auth.Token)
| 544 | } |
| 545 | |
| 546 | func getLoginFromToken(token *auth.Token) (string, error) { |
| 547 | ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout) |
| 548 | defer cancel() |
| 549 | |
| 550 | client := buildClient(token) |
| 551 | |
| 552 | var q loginQuery |
| 553 | |
| 554 | err := client.queryPrintMsgs(ctx, &q, nil) |
| 555 | if err != nil { |
| 556 | return "", err |
| 557 | } |
| 558 | if q.Viewer.Login == "" { |
| 559 | return "", fmt.Errorf("github say username is empty") |
| 560 | } |
| 561 | |
| 562 | return q.Viewer.Login, nil |
| 563 | } |
no test coverage detected