Fix codebase antipatterns: sentinel errors, error wrapping, debug cleanup#83
Draft
Fix codebase antipatterns: sentinel errors, error wrapping, debug cleanup#83
Conversation
… debug cleanup - Convert bare string errors to package-level sentinel errors (ErrTunnelClosed, ErrHubConnectionClosed, ErrServeFailed, ErrInvalidPathPrefix, ErrExecutablePath) - Fix fmt.Errorf with %v to use %w for proper error chain support - Remove bare println() debug statements from production code - Fix log.Println(fmt.Sprintf()) redundancy to use log.Printf() directly - Fix defer resp.Body.Close() placement (move before io.ReadAll) - Remove commented-out dead code and simplify empty error blocks - Clean up unnecessary defer wrapper in session plumbing Co-authored-by: btwiuse <54848194+btwiuse@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Identify and address antipatterns in the codebase
Fix codebase antipatterns: sentinel errors, error wrapping, debug cleanup
Feb 25, 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.
Sweep of common Go antipatterns across the codebase.
errors.New()/fmt.Errorf()to package-level vars (ErrTunnelClosed,ErrHubConnectionClosed,ErrServeFailed,ErrInvalidPathPrefix,ErrExecutablePath) so callers can useerrors.Is()%v→%winfmt.Errorfcalls inpkg/cli/upgradeto preserve error chainsprintln(): Five debugprintln()calls writing to stderr in production with no log-level controllog.Println(fmt.Sprintf(…))→log.Printf(…)defer resp.Body.Close()ordering: Moved beforeio.ReadAllin bothagent/configandclient/configso the body is closed even if the read fails// log.Println(err), commented-out function blocks, empty error branches✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.