Skip to content

Commit 0803d01

Browse files
francisfuzzCopilot
andcommitted
Fix build command and errors.As usage per review feedback
- go build ./... compiles but does not produce a binary. Changed to go build -o gh-stack . which actually outputs the executable. - errors.As(err, &ExitError{}) panics at runtime because the value type ExitError does not satisfy the error interface (only *ExitError does). Updated to the correct two-line pattern matching cmd/root.go. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 31ee458 commit 0803d01

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ No Makefile, no code generation, no external linter config. Standard Go toolchai
2525
## Coding conventions
2626

2727
- Return typed `ExitError` sentinels (codes 1-10 in `cmd/utils.go`) from `RunE`. Never call `os.Exit()` directly.
28-
- Check errors with `errors.As(err, &ExitError{})`.
28+
- Check errors with `var exitErr *ExitError; errors.As(err, &exitErr)`.
2929
- Table-driven tests with `t.Run()` subtests.
3030
- Use `config.NewTestConfig()` for test configs with captured I/O.
3131
- Mock git: `restore := git.SetOps(&git.MockOps{...}); defer restore()`. Always defer restore.

AGENTS.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ Use typed exit codes defined in `cmd/utils.go`:
8989
| 9 | `ErrStacksUnavailable` | Stacked PRs not enabled for repository |
9090
| 10 | `ErrModifyRecovery` | Modify session interrupted |
9191

92-
Return these from `RunE`. Never call `os.Exit()` directly from commands. Check with `errors.As(err, &ExitError{})`.
92+
Return these from `RunE`. Never call `os.Exit()` directly from commands. Check with:
93+
94+
```go
95+
var exitErr *ExitError
96+
if errors.As(err, &exitErr) { ... }
97+
```
9398

9499
### Testing patterns
95100

0 commit comments

Comments
 (0)