Skip to content

fix: return nil instead of err variable in isLocalhost success path#1388

Merged
k1LoW merged 1 commit intomainfrom
fix
Feb 14, 2026
Merged

fix: return nil instead of err variable in isLocalhost success path#1388
k1LoW merged 1 commit intomainfrom
fix

Conversation

@k1LoW
Copy link
Owner

@k1LoW k1LoW commented Feb 14, 2026

This pull request makes a small fix to the isLocalhost function in http.go. The change ensures that when a loopback IP is detected, the function returns nil for the error instead of propagating a previous error value.

@k1LoW k1LoW self-assigned this Feb 14, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @k1LoW, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the error handling within the isLocalhost function. The change ensures that when a local loopback address is successfully identified, the function correctly signals success by returning a nil error, rather than inadvertently returning an error that might have occurred earlier in the function's execution. This improves the robustness and clarity of the function's output.

Highlights

  • Error Handling Correction: The isLocalhost function was updated to explicitly return nil for the error value when a loopback IP is successfully detected. This prevents the propagation of a potentially stale or incorrect error from previous operations within the function.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • http.go
    • Corrected error return value in isLocalhost function when a loopback IP is found.
Activity
  • No specific activity (comments, reviews) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly addresses an issue in the isLocalhost function. By returning nil for the error when a loopback IP is successfully identified, the function now accurately reflects a successful outcome without propagating a potentially stale or irrelevant error value. This improves the correctness and clarity of the error handling in this specific success path.

@github-actions
Copy link
Contributor

BenchmarkManyRunbooks-4

main (-) #1388 (5bc85c7) +/-
Number of iterations 1 1 0
Nanoseconds per iteration 3,664,228,203 ns/op 3,531,475,670 ns/op -132,752,533 ns/op
Bytes allocated per iteration 1,381,661,056 B/op 1,381,419,856 B/op -241,200 B/op
Allocs per iteration 19,288,803 allocs/op 19,288,925 allocs/op 122 allocs/op
Metadata
main (-) #1388 (5bc85c7)
goos linux linux
goarch amd64 amd64
pkg github.com/k1LoW/runn github.com/k1LoW/runn
cpu AMD EPYC 7763 64-Core Processor AMD EPYC 7763 64-Core Processor

BenchmarkOpenAPI3-4

main (-) #1388 (5bc85c7) +/-
Number of iterations 1 1 0
Nanoseconds per iteration 2,510,827,530 ns/op 2,569,181,850 ns/op 58,354,320 ns/op
Bytes allocated per iteration 1,280,037,560 B/op 1,280,241,920 B/op 204,360 B/op
Allocs per iteration 18,647,237 allocs/op 18,647,684 allocs/op 447 allocs/op
Metadata
main (-) #1388 (5bc85c7)
goos linux linux
goarch amd64 amd64
pkg github.com/k1LoW/runn github.com/k1LoW/runn
cpu AMD EPYC 7763 64-Core Processor AMD EPYC 7763 64-Core Processor

BenchmarkSingleRunbook-4

main (-) #1388 (5bc85c7) +/-
Number of iterations 22 25 3
Nanoseconds per iteration 45,556,841 ns/op 45,922,398 ns/op 365,557 ns/op
Bytes allocated per iteration 23,025,345 B/op 23,030,861 B/op 5,516 B/op
Allocs per iteration 186,806 allocs/op 186,800 allocs/op -6 allocs/op
Metadata
main (-) #1388 (5bc85c7)
goos linux linux
goarch amd64 amd64
pkg github.com/k1LoW/runn github.com/k1LoW/runn
cpu AMD EPYC 7763 64-Core Processor AMD EPYC 7763 64-Core Processor

Reported by octocov

@github-actions
Copy link
Contributor

Code Metrics Report

main (dce4c99) #1388 (5bc85c7) +/-
Coverage 60.2% 60.2% +0.0%
Code to Test Ratio 1:0.8 1:0.8 0.0
Test Execution Time 8m1s 7m6s -55s
Details
  |                     | main (dce4c99) | #1388 (5bc85c7) |  +/-  |
  |---------------------|----------------|-----------------|-------|
+ | Coverage            |          60.2% |           60.2% | +0.0% |
  |   Files             |             81 |              81 |     0 |
  |   Lines             |           9248 |            9248 |     0 |
+ |   Covered           |           5575 |            5576 |    +1 |
  | Code to Test Ratio  |          1:0.8 |           1:0.8 |   0.0 |
  |   Code              |          17297 |           17297 |     0 |
  |   Test              |          14395 |           14395 |     0 |
+ | Test Execution Time |           8m1s |            7m6s |  -55s |

Code coverage of files in pull request scope (74.2% → 74.4%)

Files Coverage +/- Status
http.go 78.4% 0.0% modified
internal/expr/expr.go 65.9% +0.7% affected

Reported by octocov

@k1LoW k1LoW merged commit 3b896a5 into main Feb 14, 2026
9 checks passed
@k1LoW k1LoW deleted the fix branch February 14, 2026 06:24
@github-actions github-actions bot mentioned this pull request Feb 10, 2026
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

Comments