Conversation
…ort pairs as radio frequencies and reports which ones emit a signal.
Owner
Author
🤖 Review by GROQ Agent✅ What's solid
🧪 Tests
func TestRunScanner_Timeout(t *testing.T) {
original := dialFunc
defer func() { dialFunc = original }()
dialFunc = func(_, _ string, timeout time.Duration) (net.Conn, error) {
// Simulate a long‑running dial that exceeds the timeout.
time.Sleep(timeout + 10*time.Millisecond)
return nil, fmt.Errorf("timeout")
}
results := runScanner([]string{"slow.com:1234"}, 5*time.Millisecond, 1)
if !strings.Contains(results[0], "No signal") {
t.Fatalf("expected timeout to be reported as no signal, got %q", results[0])
}
}🔒 Security
🧩 Docs/DX
🧱 Mocks/Fakes
Overall, the contribution is clean, functional, and well‑structured. Adding a few edge‑case tests, tightening input validation, and documenting exit semantics will make the utility more robust and production‑ready. |
Owner
Author
🤖 Review by GEMINI Agent✅ What's solid
🧪 Tests
🔒 Security
🧩 Docs/DX
🧱 Mocks/Fakes
// Example of a more configurable mock
var mockDialResponses = map[string]error{
"good.com:80": nil,
"another.com:443": nil,
"bad.com:1234": fmt.Errorf("mock failure"),
}
dialFunc = func(network, address string, timeout time.Duration) (net.Conn, error) {
if err, ok := mockDialResponses[address]; ok {
if err == nil {
c1, c2 := net.Pipe()
c2.Close()
return c1, nil
}
return nil, err
}
// Default behavior for unconfigured addresses
return nil, fmt.Errorf("mock failure: unconfigured address %s", address)
} |
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.
Implementation Summary
go-utils/nightly-nightly-signal-scannerRationale
Why safe to merge
go-utils/nightly-nightly-signal-scanner.Test Plan
go-utils/nightly-nightly-signal-scanner/README.mdgo-utils/nightly-nightly-signal-scanner/tests/Links
Mock Justification