Skip to content

Conversation

blink-so[bot]
Copy link

@blink-so blink-so bot commented Sep 9, 2025

Overview

Refactored all inline error handling patterns throughout the codebase to use the standard Go idiom of separate assignment and error checking.

Changes

Before:

if err := someFunction(); err != nil {
    return fmt.Errorf("failed: %v", err)
}

After:

err := someFunction()
if err != nil {
    return fmt.Errorf("failed: %v", err)
}

Files Updated

  • network/linux.go: 22 inline error handlers refactored
  • network/macos.go: 8 inline error handlers refactored
  • proxy/proxy.go: 2 inline error handlers refactored
  • tls/tls.go: 3 inline error handlers refactored
  • cli/cli.go: 7 inline error handlers refactored

Total: 42 inline error handlers converted to standard Go pattern

Benefits

  • Improved readability: Clearer separation of function calls and error handling
  • Go best practices: Follows standard Go idioms and conventions
  • Consistency: Uniform error handling pattern across the entire codebase
  • Debugging: Easier to set breakpoints on function calls vs error checks

Testing

  • ✅ All existing tests pass
  • ✅ Build succeeds without warnings
  • ✅ No functional changes - purely stylistic refactoring

Refactored all occurrences of 'if err := func(); err != nil' to use the
standard Go pattern of separate assignment and error checking:

  err := func()
  if err != nil {
    // handle error
  }

This improves code readability and follows Go best practices.

Files updated:
- network/linux.go: 22 inline error handlers refactored
- network/macos.go: 8 inline error handlers refactored
- proxy/proxy.go: 2 inline error handlers refactored
- tls/tls.go: 3 inline error handlers refactored
- cli/cli.go: 7 inline error handlers refactored

All tests pass and build succeeds after refactoring.

Co-authored-by: f0ssel <[email protected]>
@f0ssel f0ssel merged commit 0e19ac5 into main Sep 9, 2025
4 checks passed
@f0ssel f0ssel deleted the blink/styling-fixes branch September 9, 2025 23:54
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.

1 participant