Update go-gh to v2 (#7299) · cli/cli@dbc2f05 · GitHub
Skip to content

Commit dbc2f05

Browse files
authored
Update go-gh to v2 (#7299)
* Update go-gh * Update code for go-gh v2
1 parent c0855a3 commit dbc2f05

23 files changed

Lines changed: 55 additions & 57 deletions

File tree

‎api/client.go‎

Lines changed: 13 additions & 14 deletions

‎api/http_client.go‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ import (
99

1010
"github.com/cli/cli/v2/internal/ghinstance"
1111
"github.com/cli/cli/v2/utils"
12-
"github.com/cli/go-gh"
13-
ghAPI "github.com/cli/go-gh/pkg/api"
12+
ghAPI "github.com/cli/go-gh/v2/pkg/api"
1413
)
1514

1615
type tokenGetter interface {
@@ -55,7 +54,7 @@ func NewHTTPClient(opts HTTPClientOptions) (*http.Client, error) {
5554
clientOpts.CacheTTL = opts.CacheTTL
5655
}
5756

58-
client, err := gh.HTTPClient(&clientOpts)
57+
client, err := ghAPI.NewHTTPClient(clientOpts)
5958
if err != nil {
6059
return nil, err
6160
}

‎api/queries_projects_v2.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ func CurrentUserProjectsV2(client *Client, hostname string) ([]ProjectV2, error)
255255
// When querying ProjectsV2 fields we generally dont want to show the user
256256
// scope errors and field does not exist errors. ProjectsV2IgnorableError
257257
// checks against known error strings to see if an error can be safely ignored.
258-
// Due to the fact that the GQLClient can return multiple types of errors
258+
// Due to the fact that the GraphQLClient can return multiple types of errors
259259
// this uses brittle string comparison to check against the known error strings.
260260
func ProjectsV2IgnorableError(err error) bool {
261261
msg := err.Error()

‎api/queries_repo.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"golang.org/x/sync/errgroup"
1717

1818
"github.com/cli/cli/v2/internal/ghrepo"
19-
ghAPI "github.com/cli/go-gh/pkg/api"
19+
ghAPI "github.com/cli/go-gh/v2/pkg/api"
2020
"github.com/shurcooL/githubv4"
2121
)
2222

@@ -263,8 +263,8 @@ func FetchRepository(client *Client, repo ghrepo.Interface, fields []string) (*R
263263
// guaranteed to happen when an authentication token with insufficient permissions is being used.
264264
if result.Repository == nil {
265265
return nil, GraphQLError{
266-
GQLError: ghAPI.GQLError{
267-
Errors: []ghAPI.GQLErrorItem{{
266+
GraphQLError: &ghAPI.GraphQLError{
267+
Errors: []ghAPI.GraphQLErrorItem{{
268268
Type: "NOT_FOUND",
269269
Message: fmt.Sprintf("Could not resolve to a Repository with the name '%s/%s'.", repo.RepoOwner(), repo.RepoName()),
270270
}},
@@ -316,8 +316,8 @@ func GitHubRepo(client *Client, repo ghrepo.Interface) (*Repository, error) {
316316
// guaranteed to happen when an authentication token with insufficient permissions is being used.
317317
if result.Repository == nil {
318318
return nil, GraphQLError{
319-
GQLError: ghAPI.GQLError{
320-
Errors: []ghAPI.GQLErrorItem{{
319+
GraphQLError: &ghAPI.GraphQLError{
320+
Errors: []ghAPI.GraphQLErrorItem{{
321321
Type: "NOT_FOUND",
322322
Message: fmt.Sprintf("Could not resolve to a Repository with the name '%s/%s'.", repo.RepoOwner(), repo.RepoName()),
323323
}},

‎go.mod‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/cenkalti/backoff/v4 v4.2.0
1010
github.com/charmbracelet/glamour v0.5.1-0.20220727184942-e70ff2d969da
1111
github.com/charmbracelet/lipgloss v0.5.0
12-
github.com/cli/go-gh v1.2.1
12+
github.com/cli/go-gh/v2 v2.0.0
1313
github.com/cli/oauth v1.0.1
1414
github.com/cli/safeexec v1.0.1
1515
github.com/cpuguy83/go-md2man/v2 v2.0.2
@@ -50,7 +50,7 @@ require (
5050
github.com/alessio/shellescape v1.4.1 // indirect
5151
github.com/aymerick/douceur v0.2.0 // indirect
5252
github.com/cli/browser v1.1.0 // indirect
53-
github.com/cli/shurcooL-graphql v0.0.2 // indirect
53+
github.com/cli/shurcooL-graphql v0.0.3 // indirect
5454
github.com/danieljoos/wincred v1.1.2 // indirect
5555
github.com/davecgh/go-spew v1.1.1 // indirect
5656
github.com/dlclark/regexp2 v1.4.0 // indirect

‎go.sum‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ github.com/cli/browser v1.1.0 h1:xOZBfkfY9L9vMBgqb1YwRirGu6QFaQ5dP/vXt5ENSOY=
6262
github.com/cli/browser v1.1.0/go.mod h1:HKMQAt9t12kov91Mn7RfZxyJQQgWgyS/3SZswlZ5iTI=
6363
github.com/cli/crypto v0.0.0-20210929142629-6be313f59b03 h1:3f4uHLfWx4/WlnMPXGai03eoWAI+oGHJwr+5OXfxCr8=
6464
github.com/cli/crypto v0.0.0-20210929142629-6be313f59b03/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
65-
github.com/cli/go-gh v1.2.1 h1:xFrjejSsgPiwXFP6VYynKWwxLQcNJy3Twbu82ZDlR/o=
66-
github.com/cli/go-gh v1.2.1/go.mod h1:Jxk8X+TCO4Ui/GarwY9tByWm/8zp4jJktzVZNlTW5VM=
65+
github.com/cli/go-gh/v2 v2.0.0 h1:JAgQY7VNHletsO0Eqr+/PzF7fF5QEjhY2t2+Tev3vmk=
66+
github.com/cli/go-gh/v2 v2.0.0/go.mod h1:2/ox3Dnc8wDBT5bnTAH1aKGy6Qt1ztlFBe10EufnvoA=
6767
github.com/cli/oauth v1.0.1 h1:pXnTFl/qUegXHK531Dv0LNjW4mLx626eS42gnzfXJPA=
6868
github.com/cli/oauth v1.0.1/go.mod h1:qd/FX8ZBD6n1sVNQO3aIdRxeu5LGw9WhKnYhIIoC2A4=
6969
github.com/cli/safeexec v1.0.0/go.mod h1:Z/D4tTN8Vs5gXYHDCbaM1S/anmEDnJb1iW0+EJ5zx3Q=
7070
github.com/cli/safeexec v1.0.1 h1:e/C79PbXF4yYTN/wauC4tviMxEV13BwljGj0N9j+N00=
7171
github.com/cli/safeexec v1.0.1/go.mod h1:Z/D4tTN8Vs5gXYHDCbaM1S/anmEDnJb1iW0+EJ5zx3Q=
72-
github.com/cli/shurcooL-graphql v0.0.2 h1:rwP5/qQQ2fM0TzkUTwtt6E2LbIYf6R+39cUXTa04NYk=
73-
github.com/cli/shurcooL-graphql v0.0.2/go.mod h1:tlrLmw/n5Q/+4qSvosT+9/W5zc8ZMjnJeYBxSdb4nWA=
72+
github.com/cli/shurcooL-graphql v0.0.3 h1:CtpPxyGDs136/+ZeyAfUKYmcQBjDlq5aqnrDCW5Ghh8=
73+
github.com/cli/shurcooL-graphql v0.0.3/go.mod h1:tlrLmw/n5Q/+4qSvosT+9/W5zc8ZMjnJeYBxSdb4nWA=
7474
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
7575
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
7676
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=

‎internal/browser/browser.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package browser
33
import (
44
"io"
55

6-
ghBrowser "github.com/cli/go-gh/pkg/browser"
6+
ghBrowser "github.com/cli/go-gh/v2/pkg/browser"
77
)
88

99
type Browser interface {
@@ -12,5 +12,5 @@ type Browser interface {
1212

1313
func New(launcher string, stdout, stderr io.Writer) Browser {
1414
b := ghBrowser.New(launcher, stdout, stderr)
15-
return &b
15+
return b
1616
}

‎internal/config/config.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"os"
55
"path/filepath"
66

7-
ghAuth "github.com/cli/go-gh/pkg/auth"
8-
ghConfig "github.com/cli/go-gh/pkg/config"
7+
ghAuth "github.com/cli/go-gh/v2/pkg/auth"
8+
ghConfig "github.com/cli/go-gh/v2/pkg/config"
99
"github.com/zalando/go-keyring"
1010
)
1111

‎internal/config/stub.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"path/filepath"
77
"testing"
88

9-
ghConfig "github.com/cli/go-gh/pkg/config"
9+
ghConfig "github.com/cli/go-gh/v2/pkg/config"
1010
)
1111

1212
func NewBlankConfig() *ConfigMock {

‎internal/ghrepo/repo.go‎

Lines changed: 3 additions & 3 deletions

0 commit comments

Comments
 (0)