Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Prepare exit errors for Go 1.27 - #14397

Merged
williammartin merged 1 commit into
trunkfrom
williammartin-fix-agentic-workflow
Sep 8, 2026
Merged

Prepare exit errors for Go 1.27#14397
williammartin merged 1 commit into
trunkfrom
williammartin-fix-agentic-workflow

Conversation

@williammartin

@williammartin williammartin commented Sep 8, 2026

Copy link
Copy Markdown
Member

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.As calls to errors.AsType[T]. The generic API requires T to implement error, while our three local errWithExitCode interfaces only declared ExitCode(). 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 fix on the three affected packages and then testing them. Each package failed with errWithExitCode 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.As targets that Go 1.27 migrates to errors.AsType.

Authorship and follow-up

Who wrote this:

  • A human wrote it.
  • An agent wrote it under close human direction.
  • An agent wrote it independently, and no human has guided the implementation beyond the initial prompt.

Who answers review comments:

  • @williammartin will read and reply directly.
  • An agent will draft replies and @username will read them before they are posted.
  • Nobody has explicitly committed to replying.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c2faaf54-9531-419e-a272-87d33b1ce488
Copilot AI balanced review requested due to automatic review settings September 8, 2026 17:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 errWithExitCode in three locations to embed error alongside ExitCode() int.
  • Ensures forthcoming Go 1.27 automated rewrites of errors.As to errors.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.

@williammartin
williammartin marked this pull request as ready for review September 8, 2026 17:46
@williammartin
williammartin requested a review from a team as a code owner September 8, 2026 17:46
@williammartin
williammartin merged commit 707514f into trunk Sep 8, 2026
47 checks passed
@williammartin
williammartin deleted the williammartin-fix-agentic-workflow branch September 8, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants