From 9585a356d2b988ddd8cd690a89169cc2cd0c85ae Mon Sep 17 00:00:00 2001 From: bagtoad <47394200+BagToad@users.noreply.github.com> Date: Tue, 8 Oct 2024 15:15:24 -0600 Subject: [PATCH] Make linter happy --- examples_test.go | 38 +++++++++++++++++++------------------- oauth.go | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/examples_test.go b/examples_test.go index 834e439..975c8c9 100644 --- a/examples_test.go +++ b/examples_test.go @@ -1,10 +1,10 @@ package oauth_test import ( - "fmt" - "os" + "fmt" + "os" - "github.com/cli/oauth" + "github.com/cli/oauth" ) // DetectFlow attempts to initiate OAuth Device flow with the server and falls back to OAuth Web @@ -12,22 +12,22 @@ import ( // github.com, as its Device flow support is globally available, but it enables logging in to // self-hosted GitHub instances as well. func ExampleFlow_DetectFlow() { - host, err := oauth.NewGitHubHost("https://github.com") - if err != nil { - panic(err) - } - flow := &oauth.Flow{ - Host: host, - ClientID: os.Getenv("OAUTH_CLIENT_ID"), - ClientSecret: os.Getenv("OAUTH_CLIENT_SECRET"), // only applicable to web app flow - CallbackURI: "http://127.0.0.1/callback", // only applicable to web app flow - Scopes: []string{"repo", "read:org", "gist"}, - } + host, err := oauth.NewGitHubHost("https://github.com") + if err != nil { + panic(err) + } + flow := &oauth.Flow{ + Host: host, + ClientID: os.Getenv("OAUTH_CLIENT_ID"), + ClientSecret: os.Getenv("OAUTH_CLIENT_SECRET"), // only applicable to web app flow + CallbackURI: "http://127.0.0.1/callback", // only applicable to web app flow + Scopes: []string{"repo", "read:org", "gist"}, + } - accessToken, err := flow.DetectFlow() - if err != nil { - panic(err) - } + accessToken, err := flow.DetectFlow() + if err != nil { + panic(err) + } - fmt.Printf("Access token: %s\n", accessToken.Token) + fmt.Printf("Access token: %s\n", accessToken.Token) } diff --git a/oauth.go b/oauth.go index 4e1c5ef..7e38c71 100644 --- a/oauth.go +++ b/oauth.go @@ -46,7 +46,7 @@ func NewGitHubHost(hostURL string) (*Host, error) { } // GitHubHost constructs a Host from the given URL to a GitHub instance. -// +// // Deprecated: `GitHubHost` can panic with a malformed `hostURL`. Use `NewGitHubHost` instead for graceful error handling. func GitHubHost(hostURL string) *Host { u, _ := url.Parse(hostURL)