Skip to content

Commit 9585a35

Browse files
committed
Make linter happy
1 parent 7e4a31f commit 9585a35

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

examples_test.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
package oauth_test
22

33
import (
4-
"fmt"
5-
"os"
4+
"fmt"
5+
"os"
66

7-
"github.com/cli/oauth"
7+
"github.com/cli/oauth"
88
)
99

1010
// DetectFlow attempts to initiate OAuth Device flow with the server and falls back to OAuth Web
1111
// application flow if Device flow seems unsupported. This approach isn't strictly needed for
1212
// github.com, as its Device flow support is globally available, but it enables logging in to
1313
// self-hosted GitHub instances as well.
1414
func ExampleFlow_DetectFlow() {
15-
host, err := oauth.NewGitHubHost("https://github.com")
16-
if err != nil {
17-
panic(err)
18-
}
19-
flow := &oauth.Flow{
20-
Host: host,
21-
ClientID: os.Getenv("OAUTH_CLIENT_ID"),
22-
ClientSecret: os.Getenv("OAUTH_CLIENT_SECRET"), // only applicable to web app flow
23-
CallbackURI: "http://127.0.0.1/callback", // only applicable to web app flow
24-
Scopes: []string{"repo", "read:org", "gist"},
25-
}
15+
host, err := oauth.NewGitHubHost("https://github.com")
16+
if err != nil {
17+
panic(err)
18+
}
19+
flow := &oauth.Flow{
20+
Host: host,
21+
ClientID: os.Getenv("OAUTH_CLIENT_ID"),
22+
ClientSecret: os.Getenv("OAUTH_CLIENT_SECRET"), // only applicable to web app flow
23+
CallbackURI: "http://127.0.0.1/callback", // only applicable to web app flow
24+
Scopes: []string{"repo", "read:org", "gist"},
25+
}
2626

27-
accessToken, err := flow.DetectFlow()
28-
if err != nil {
29-
panic(err)
30-
}
27+
accessToken, err := flow.DetectFlow()
28+
if err != nil {
29+
panic(err)
30+
}
3131

32-
fmt.Printf("Access token: %s\n", accessToken.Token)
32+
fmt.Printf("Access token: %s\n", accessToken.Token)
3333
}

oauth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func NewGitHubHost(hostURL string) (*Host, error) {
4646
}
4747

4848
// GitHubHost constructs a Host from the given URL to a GitHub instance.
49-
//
49+
//
5050
// Deprecated: `GitHubHost` can panic with a malformed `hostURL`. Use `NewGitHubHost` instead for graceful error handling.
5151
func GitHubHost(hostURL string) *Host {
5252
u, _ := url.Parse(hostURL)

0 commit comments

Comments
 (0)