Prepare exit errors for Go 1.27 - #14397
Merged
Merged
Conversation
Co-authored-by: Copilot App <[email protected]> Copilot-Session: c2faaf54-9531-419e-a272-87d33b1ce488
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The change is narrowly scoped, internally consistent across the three call sites, and preserves behavior while unblocking Go 1.27 source migration.
Review tier: Lite
Findings: None
What changed in this PR
This PR prepares the codebase for Go 1.27’s go fix migration that rewrites certain errors.As patterns to errors.AsType[T] by updating local errWithExitCode interfaces to explicitly satisfy the error constraint.
Changes:
- Updated
errWithExitCodein three locations to embederroralongsideExitCode() int. - Ensures forthcoming Go 1.27 automated rewrites of
errors.Astoerrors.AsType[T]will compile without changing runtime behavior.
| File | Description |
|---|---|
| pkg/cmd/repo/fork/fork.go | Makes the local errWithExitCode interface satisfy error for future errors.AsType migration compatibility. |
| pkg/cmd/repo/create/create.go | Same interface update to unblock Go 1.27 go fix rewriting in repo creation flows. |
| git/client.go | Updates the git package’s errWithExitCode interface to meet the generic error constraint used by Go 1.27 rewrites. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
BagToad
approved these changes
Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Failed workflow run: https://github.com/cli/cli/actions/runs/34183103920
Description
The Go bump workflow now reaches
go fix, tests, and lint as intended, but the first post-merge run exposed a Go 1.27 source migration incompatibility.Go 1.27 rewrites these
errors.Ascalls toerrors.AsType[T]. The generic API requiresTto implementerror, while our three localerrWithExitCodeinterfaces only declaredExitCode(). Their runtime implementations are already errors; this makes that existing contract explicit so the generated migration compiles.How did you test this change?
I reproduced the workflow failure in an isolated current-trunk worktree by running Go 1.27's
go fixon the three affected packages and then testing them. Each package failed witherrWithExitCode does not satisfy error (missing method Error).After this change, I repeated that same migration and the three package tests completed successfully. I then ran the complete merged bump script with Go 1.27.1 and golangci-lint v2.13.2;
go mod tidy,go fix, the full test suite, lint, generated commit, and cleanup all completed.Key points
This does not apply the Go 1.27 migration itself. It only expresses the contract required for the next scheduled bump run to generate and validate that migration in its own pull request.
Notes for reviewers
The three changes are identical and correspond to the three
errors.Astargets that Go 1.27 migrates toerrors.AsType.Authorship and follow-up
Who wrote this:
Who answers review comments: