From 780d883f6b164e5cd05b98c1402b41987b7a52ee Mon Sep 17 00:00:00 2001 From: Jon Gallant <2163001+jongio@users.noreply.github.com> Date: Tue, 30 Jun 2026 13:40:31 -0700 Subject: [PATCH] deps: upgrade go-github v68->v88 and anthropic-sdk-go v1.54.0 Upgrade Go module dependencies to latest: - github.com/google/go-github/v68 -> v88 (major, breaking API) - github.com/anthropics/anthropic-sdk-go v1.53.0 -> v1.54.0 Adapt to go-github v88 API changes: - NewClient now returns (*Client, error) and takes ClientOptionsFunc options; use gh.WithAuthToken / gh.WithHTTPClient instead of the removed (*Client).WithAuthToken method. - IssueListByRepoOptions embeds both ListCursorOptions and ListOptions, so qualify the ambiguous Page selector as ListOptions.Page. - CreateWorkflowDispatchEventByID now returns three values. - BaseURL/UploadURL fields are unexported; the test helper now routes requests through a URL-rewriting http.Client transport so existing mock handlers keep matching. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- internal/github/auth.go | 7 ++++-- internal/github/cache.go | 2 +- internal/github/client.go | 14 ++++++------ internal/github/client_test.go | 22 ++++++++++++++----- internal/github/coverage_test.go | 2 +- internal/github/github_extra_test.go | 4 ++-- internal/github/interfaces.go | 2 +- internal/github/pagination.go | 2 +- internal/github/workflow.go | 2 +- .../panels/gitinfo/gitinfo_coverage_test.go | 2 +- internal/panels/gitinfo/gitinfo_github.go | 2 +- internal/panels/gitinfo/gitinfo_test.go | 2 +- 14 files changed, 42 insertions(+), 27 deletions(-) diff --git a/go.mod b/go.mod index d4c4df9b..1d1b5bc5 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/fsnotify/fsnotify v1.10.1 github.com/gabriel-vasile/mimetype v1.4.13 github.com/github/copilot-sdk/go v1.0.4 - github.com/google/go-github/v68 v68.0.0 + github.com/google/go-github/v88 v88.0.0 github.com/mark3labs/mcp-go v0.55.1 github.com/mattn/go-runewidth v0.0.24 github.com/pelletier/go-toml/v2 v2.4.2 diff --git a/go.sum b/go.sum index 5c79b30e..fc749921 100644 --- a/go.sum +++ b/go.sum @@ -76,8 +76,8 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/go-github/v68 v68.0.0 h1:ZW57zeNZiXTdQ16qrDiZ0k6XucrxZ2CGmoTvcCyQG6s= -github.com/google/go-github/v68 v68.0.0/go.mod h1:K9HAUBovM2sLwM408A18h+wd9vqdLOEqTUCbnRIcx68= +github.com/google/go-github/v88 v88.0.0 h1:dZA9IKkPK1eXZj4ypngnpRj5FwdpTv4whix2PrQMP7M= +github.com/google/go-github/v88 v88.0.0/go.mod h1:rufTDgn2N45wjhukLTyxmvc9nilSp3mr3Rgtt6b1MPw= github.com/google/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0= github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU= github.com/google/jsonschema-go v0.4.3 h1:/DBOLZTfDow7pe2GmaJNhltueGTtDKICi8V8p+DQPd0= diff --git a/internal/github/auth.go b/internal/github/auth.go index 026dd7e6..3b52556f 100644 --- a/internal/github/auth.go +++ b/internal/github/auth.go @@ -8,7 +8,7 @@ import ( "strings" "time" - gh "github.com/google/go-github/v68/github" + gh "github.com/google/go-github/v88/github" ) // ghCLITimeout is the maximum time to wait for the `gh` CLI to return an @@ -24,7 +24,10 @@ func NewClient(ctx context.Context) (*clientImpl, error) { if err != nil { return nil, err } - ghClient := gh.NewClient(nil).WithAuthToken(token) + ghClient, err := gh.NewClient(gh.WithAuthToken(token)) + if err != nil { + return nil, fmt.Errorf("create github client: %w", err) + } return &clientImpl{gh: ghClient, cache: newCache()}, nil } diff --git a/internal/github/cache.go b/internal/github/cache.go index 791d46da..135f69cd 100644 --- a/internal/github/cache.go +++ b/internal/github/cache.go @@ -7,7 +7,7 @@ import ( "sync" "time" - gh "github.com/google/go-github/v68/github" + gh "github.com/google/go-github/v88/github" ) const ( diff --git a/internal/github/client.go b/internal/github/client.go index 10d9c5f9..f6c146b5 100644 --- a/internal/github/client.go +++ b/internal/github/client.go @@ -8,7 +8,7 @@ import ( "net/http" "time" - gh "github.com/google/go-github/v68/github" + gh "github.com/google/go-github/v88/github" ) // clientImpl implements the Client interface using the google/go-github SDK. @@ -41,7 +41,7 @@ func (c *clientImpl) ListIssues(ctx context.Context, owner, repo string, opts *g if opts != nil { local = *opts } - local.Page = 0 + local.ListOptions.Page = 0 key := fmt.Sprintf("issues:%s/%s:%+v", owner, repo, local) if v, ok := c.cache.Get(key); ok { issues, ok := v.([]*gh.Issue) @@ -51,7 +51,7 @@ func (c *clientImpl) ListIssues(ctx context.Context, owner, repo string, opts *g return issues, nil } - local.Page = 1 + local.ListOptions.Page = 1 allIssues := make([]*gh.Issue, 0, 30) for page := 0; page < maxPaginationPages; page++ { issues, resp, err := c.gh.Issues.ListByRepo(ctx, owner, repo, &local) @@ -66,7 +66,7 @@ func (c *clientImpl) ListIssues(ctx context.Context, owner, repo string, opts *g if resp.NextPage == 0 { break } - local.Page = resp.NextPage + local.ListOptions.Page = resp.NextPage } c.cache.Set(key, allIssues) @@ -78,8 +78,8 @@ func (c *clientImpl) ListIssuesPage(ctx context.Context, owner, repo string, opt if opts != nil { local = *opts } - if local.Page == 0 { - local.Page = 1 + if local.ListOptions.Page == 0 { + local.ListOptions.Page = 1 } key := fmt.Sprintf("issues-page:%s/%s:%+v", owner, repo, local) return listPage[*gh.Issue](c, key, "list issues page", func() ([]*gh.Issue, *gh.Response, int, error) { @@ -629,7 +629,7 @@ func (c *clientImpl) DispatchWorkflow(ctx context.Context, owner, repo string, w Ref: ref, Inputs: inputs, } - resp, err := c.gh.Actions.CreateWorkflowDispatchEventByID(ctx, owner, repo, workflowID, event) + _, resp, err := c.gh.Actions.CreateWorkflowDispatchEventByID(ctx, owner, repo, workflowID, event) if err != nil { // Surface specific auth scope issues clearly. if resp != nil && resp.StatusCode == 403 { diff --git a/internal/github/client_test.go b/internal/github/client_test.go index dbb182fa..4b333f81 100644 --- a/internal/github/client_test.go +++ b/internal/github/client_test.go @@ -12,7 +12,7 @@ import ( "testing" "time" - gh "github.com/google/go-github/v68/github" + gh "github.com/google/go-github/v88/github" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -21,6 +21,18 @@ import ( // Test helpers // --------------------------------------------------------------------------- +// urlRewriteTransport redirects all outgoing requests to the test server, +// preserving the request path so existing mock handlers keep matching. +type urlRewriteTransport struct { + base *url.URL +} + +func (t *urlRewriteTransport) RoundTrip(req *http.Request) (*http.Response, error) { + req.URL.Scheme = t.base.Scheme + req.URL.Host = t.base.Host + return http.DefaultTransport.RoundTrip(req) +} + // setupMockClient creates a clientImpl backed by an httptest server. // The server is cleaned up automatically via t.Cleanup. func setupMockClient(t *testing.T, handler http.HandlerFunc) (*clientImpl, *httptest.Server) { @@ -28,12 +40,12 @@ func setupMockClient(t *testing.T, handler http.HandlerFunc) (*clientImpl, *http server := httptest.NewServer(handler) t.Cleanup(server.Close) - ghClient := gh.NewClient(nil).WithAuthToken("test-token") baseURL, err := url.Parse(server.URL + "/") require.NoError(t, err) - ghClient.BaseURL = baseURL - // Point upload URL at the mock too so PR diff etc. work. - ghClient.UploadURL = baseURL + + httpClient := &http.Client{Transport: &urlRewriteTransport{base: baseURL}} + ghClient, err := gh.NewClient(gh.WithHTTPClient(httpClient), gh.WithAuthToken("test-token")) + require.NoError(t, err) return &clientImpl{gh: ghClient, cache: newCache()}, server } diff --git a/internal/github/coverage_test.go b/internal/github/coverage_test.go index 0381e578..8440a824 100644 --- a/internal/github/coverage_test.go +++ b/internal/github/coverage_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - gh "github.com/google/go-github/v68/github" + gh "github.com/google/go-github/v88/github" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/internal/github/github_extra_test.go b/internal/github/github_extra_test.go index bb9b9b69..e306c957 100644 --- a/internal/github/github_extra_test.go +++ b/internal/github/github_extra_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - gh "github.com/google/go-github/v68/github" + gh "github.com/google/go-github/v88/github" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -662,7 +662,7 @@ func TestClient_ListIssues_CacheTypeError(t *testing.T) { }) local := gh.IssueListByRepoOptions{} - local.Page = 0 + local.ListOptions.Page = 0 key := fmt.Sprintf("issues:%s/%s:%+v", "owner", "repo", local) client.cache.Set(key, "wrong type") diff --git a/internal/github/interfaces.go b/internal/github/interfaces.go index 398b6436..1947e974 100644 --- a/internal/github/interfaces.go +++ b/internal/github/interfaces.go @@ -3,7 +3,7 @@ package github import ( "context" - gh "github.com/google/go-github/v68/github" + gh "github.com/google/go-github/v88/github" ) // PageResult holds pagination metadata for paged list operations. diff --git a/internal/github/pagination.go b/internal/github/pagination.go index 9abe725d..01704712 100644 --- a/internal/github/pagination.go +++ b/internal/github/pagination.go @@ -3,7 +3,7 @@ package github import ( "fmt" - gh "github.com/google/go-github/v68/github" + gh "github.com/google/go-github/v88/github" ) // pageEntry is a generic cache wrapper for a single page of results. diff --git a/internal/github/workflow.go b/internal/github/workflow.go index 89995ff6..c8fd5ba1 100644 --- a/internal/github/workflow.go +++ b/internal/github/workflow.go @@ -5,7 +5,7 @@ import ( "fmt" "log/slog" - gh "github.com/google/go-github/v68/github" + gh "github.com/google/go-github/v88/github" "gopkg.in/yaml.v3" ) diff --git a/internal/panels/gitinfo/gitinfo_coverage_test.go b/internal/panels/gitinfo/gitinfo_coverage_test.go index 98fd0257..c7372617 100644 --- a/internal/panels/gitinfo/gitinfo_coverage_test.go +++ b/internal/panels/gitinfo/gitinfo_coverage_test.go @@ -6,7 +6,7 @@ import ( "time" tea "charm.land/bubbletea/v2" - gh "github.com/google/go-github/v68/github" + gh "github.com/google/go-github/v88/github" "github.com/jongio/grut/internal/config" "github.com/jongio/grut/internal/panels" "github.com/stretchr/testify/assert" diff --git a/internal/panels/gitinfo/gitinfo_github.go b/internal/panels/gitinfo/gitinfo_github.go index 37eff5b3..bd0dd42e 100644 --- a/internal/panels/gitinfo/gitinfo_github.go +++ b/internal/panels/gitinfo/gitinfo_github.go @@ -10,7 +10,7 @@ import ( tea "charm.land/bubbletea/v2" "charm.land/lipgloss/v2" - gh "github.com/google/go-github/v68/github" + gh "github.com/google/go-github/v88/github" ghclient "github.com/jongio/grut/internal/github" "github.com/jongio/grut/internal/notify" "github.com/jongio/grut/internal/panels" diff --git a/internal/panels/gitinfo/gitinfo_test.go b/internal/panels/gitinfo/gitinfo_test.go index 6c92fc80..6a648841 100644 --- a/internal/panels/gitinfo/gitinfo_test.go +++ b/internal/panels/gitinfo/gitinfo_test.go @@ -9,7 +9,7 @@ import ( "time" tea "charm.land/bubbletea/v2" - gh "github.com/google/go-github/v68/github" + gh "github.com/google/go-github/v88/github" "github.com/jongio/grut/internal/actions" "github.com/jongio/grut/internal/config" "github.com/jongio/grut/internal/git"