Skip to content

fix(subscraping): use DialContext instead of the deprecated Dial - #1835

Merged
ehsandeep merged 1 commit into
projectdiscovery:devfrom
jonaslejon:fix/dialcontext-deprecation
Aug 22, 2026
Merged

ehsandeep merged 1 commit into
projectdiscovery:devfrom
jonaslejon:fix/dialcontext-deprecation

Conversation

@jonaslejon

@jonaslejon jonaslejon commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Proposed changes

golangci-lint reports one issue on dev:

pkg/subscraping/agent.go:53:3: SA1019: (net/http.Transport).Dial has been deprecated since Go 1.7:
Use DialContext instead, which allows the transport to cancel dials as soon as they are no longer
needed. If both are set, DialContext takes priority. (staticcheck)

Test Builds declares needs: [lint], so that single finding fails the lint job and skips the
build, test, race-condition and example steps on every pull request
. The effect is that PRs show a
red check with no green signal behind them, and the test suite does not run in CI at all.

DialContext is the documented replacement and takes priority when both are set, so behaviour is
unchanged.

Proof

Reproducible on an unmodified checkout:

$ git clone --depth 1 --branch dev https://github.com/projectdiscovery/subfinder.git
$ cd subfinder && golangci-lint run
pkg/subscraping/agent.go:53:3: SA1019: ...
1 issues: staticcheck: 1

With this change:

$ golangci-lint run
0 issues.
$ go build ./... && go test ./pkg/...
ok

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

No test added: this is a two-line deprecation fix, and golangci-lint in CI is the check that
proves it.

I noticed this while working on an unrelated PR (#1834) whose lint job inherits the same finding.
Sending it separately rather than folding it in there.

Summary by CodeRabbit

  • Bug Fixes
    • Improved connection handling while preserving configured connection timeouts.
    • Replaced a deprecated networking mechanism to support more reliable HTTP connections.

golangci-lint reports SA1019 for net/http.Transport.Dial, deprecated since
Go 1.7. Because Test Builds declares needs: [lint], that single finding fails
the lint job and skips the build, test, race and example steps on every pull
request.

DialContext is the documented replacement and takes priority when both are set,
so behaviour is unchanged. golangci-lint goes from 1 issue to 0 across the tree.
@jonaslejon jonaslejon mentioned this pull request Aug 22, 2026
4 tasks done
@coderabbitai

coderabbitai Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: eedb9330-7f14-4ca7-ac9f-5e81ad5b4de1

📥 Commits

Reviewing files that changed from the base of the PR and between 717f59d and 146df47.

📒 Files selected for processing (1)
  • pkg/subscraping/agent.go

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


Walkthrough

NewSession now uses DialContext for HTTP transport connections. The configured connection timeout remains unchanged.

Changes

HTTP transport configuration

Layer / File(s) Summary
Transport dial configuration
pkg/subscraping/agent.go
NewSession replaces the deprecated Dial callback with DialContext and preserves the timeout in seconds.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 146df

This localized change replaces the deprecated dialing API so CI linting can run normally while preserving intended request behavior; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: mzack9999

Poem

A rabbit hops through bytes so bright,
And tunes the dial for modern flight.
Context guides each connection true,
The timeout stays as it used to do.
“Hop approved!” the rabbit sings,
While cleaner transport takes its wings.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change from deprecated Dial to DialContext.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ehsandeep
ehsandeep merged commit 534188a into projectdiscovery:dev Aug 22, 2026
9 checks passed
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
subfinder 2.16.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre><!-- Release notes generated using configuration in .github/release.yml at main -->

## What's Changed

* feat(sources): honor -max-results across paginating sources by @Gerijacki in projectdiscovery/subfinder#1810
* fix(extractor): match the target domain literally and reject partial hosts by @Gerijacki in projectdiscovery/subfinder#1811
* fix(subscraping): cap untrusted source response bodies with a size limit by @adamsjack711-ux in projectdiscovery/subfinder#1809
* fix(subscraping): use DialContext instead of the deprecated Dial by @jonaslejon in projectdiscovery/subfinder#1835
* feat: add scanmalware passive source by @jonaslejon in projectdiscovery/subfinder#1834
* fix(crtsh): set statement_timeout via SQL query to avoid PgBouncer handshake rejection (#1828) by @gcoinstash-cmd in projectdiscovery/subfinder#1832

## New Contributors
* @J12934 made their first contribution in projectdiscovery/subfinder#1823
* @adamsjack711-ux made their first contribution in projectdiscovery/subfinder#1809
* @gcoinstash-cmd made their first contribution in projectdiscovery/subfinder#1832

**Full Changelog**: https://github.com/projectdiscovery/subfinder/compare/v2.15.0...v2.16.0</pre>
  <p>View the full release notes at <a href="https://github.com/projectdiscovery/subfinder/releases/tag/v2.16.0">https://github.com/projectdiscovery/subfinder/releases/tag/v2.16.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!17505
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.

2 participants