Skip to content

fix lint issues - #1820

Merged
dogancanbakir merged 1 commit into
devfrom
fix-lint-issues
Aug 5, 2026
Merged

dogancanbakir merged 1 commit into
devfrom
fix-lint-issues

Conversation

@dogancanbakir

@dogancanbakir dogancanbakir commented Aug 5, 2026 •

Copy link
Copy Markdown
Member

Replace deprecated golang.org/x/exp/maps and golang.org/x/exp/slices with the stdlib maps and slices, fixing the govet inline errors reported by golangci-lint v2.12.2.

Summary by CodeRabbit

  • Refactor
    • Updated internal handling of source and statistics lists to use built-in functionality, with no change to user-facing behavior.
    • Standardized ordering in debug and statistics output for more consistent results.
  • Chores
    • Cleaned up dependency usage by moving an experimental library to indirect-only use.

golangci-lint v2.12.2 enables govet's inline analyzer, which reports
"cannot inline: type parameter inference is not yet supported" on calls
into golang.org/x/exp/maps and golang.org/x/exp/slices, since those are
marked //go:fix inline upstream.

Switch to the stdlib maps/slices packages:
- maps.Copy, slices.Contains are drop-in
- maps.Keys/maps.Values now return iterators, so wrap in
  slices.Collect (or slices.Sorted where the result was already sorted)

golang.org/x/exp drops to an indirect dependency.
@coderabbitai

coderabbitai Bot commented Aug 5, 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

Run ID: efd791a4-b602-4947-bc08-1d4fd5fe8009

📥 Commits

Reviewing files that changed from the base of the PR and between ada56ad and edd7132.

📒 Files selected for processing (5)
  • go.mod
  • pkg/passive/sources.go
  • pkg/passive/sources_test.go
  • pkg/passive/sources_wo_auth_test.go
  • pkg/runner/stats.go

Walkthrough

The change replaces experimental map and slice utilities with standard-library packages in source handling, statistics, and tests. It preserves deterministic source ordering and moves golang.org/x/exp to the indirect dependency block.

Changes

Standard-library collection migration

Layer / File(s) Summary
Dependency declaration
go.mod
Moves golang.org/x/exp to the indirect dependency block with the same version.
Collection API usage
pkg/passive/sources.go, pkg/passive/sources_test.go, pkg/passive/sources_wo_auth_test.go, pkg/runner/stats.go
Replaces experimental map and slice utilities with standard-library APIs. Source names remain sorted, and map values or keys are collected into slices.

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

Poem

I hop through maps with ears held high,
Standard slices now pass me by.
Source names line up neat and bright,
Statistics sort in proper light.
The old dependency rests indirect—
A tidy burrow, well kept.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fix lint issues' is vague and does not clearly convey the primary change: migrating from experimental packages to standard library packages. Use a more specific title such as 'Replace golang.org/x/exp with standard library maps and slices packages' to clearly communicate the main change.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-lint-issues

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

@dogancanbakir

dogancanbakir commented Aug 5, 2026 •

Copy link
Copy Markdown
Member Author

@coderabbitai create an issue to track this pr

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="projectdiscovery/subfinder"
pr_number="1820"
pr_url="https://github.com/projectdiscovery/subfinder/pull/${pr_number}"
requester="dogancanbakir"

comment_url="$(
  gh api "repos/${repo}/issues/${pr_number}/comments" --paginate \
    --jq '.[] | select(.user.login == "dogancanbakir" and (.body | contains("`@coderabbitai` create an issue to track this pr"))) | .html_url' \
  | head -n 1
)"

if [[ -z "${comment_url}" ]]; then
  echo "Could not find the requesting PR comment URL." >&2
  exit 1
fi

body="$(cat <<EOF
## Summary
Track the standard-library migration in pull request #${pr_number}.

## Required changes
- Replace direct usages of \`golang.org/x/exp/maps\` and \`golang.org/x/exp/slices\` with the Go standard-library \`maps\` and \`slices\` packages.
- Preserve behavior where \`maps.Keys\` and \`maps.Values\` now return iterators by using \`slices.Collect\` or \`slices.Sorted\` as required.
- Keep \`golang.org/x/exp\` only as an indirect dependency if other dependencies still require it.

## Rationale
\`golangci-lint v2.12.2\` enables the \`govet\` inline analyzer. The analyzer reports deprecated experimental \`maps\` and \`slices\` package usage.

## Affected areas
- \`go.mod\`
- \`pkg/passive/sources.go\`
- \`pkg/passive/sources_test.go\`
- \`pkg/passive/sources_wo_auth_test.go\`
- \`pkg/runner/stats.go\`

## Acceptance criteria
- No direct imports of \`golang.org/x/exp/maps\` or \`golang.org/x/exp/slices\` remain in the affected code.
- Map key and value ordering and collection behavior remain correct.
- The lint errors described by the pull request no longer occur.

## Backlinks
- Pull request: ${pr_url}
- Requesting comment: ${comment_url}
- Requested by: @${requester}
EOF
)"

gh issue create \
  --repo "${repo}" \
  --title "Track migration from golang.org/x/exp maps and slices to the Go standard library" \
  --body "${body}" \
  --assignee "${requester}"

Length of output: 2128


@dogancanbakir Created tracking issue #1821 and assigned it to you: #1821

You are interacting with an AI system.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="projectdiscovery/subfinder"
pr_number="1820"
requester="dogancanbakir"
pr_url="https://github.com/${repo}/pull/${pr_number}"

comment_url="$(
  gh api "repos/${repo}/issues/${pr_number}/comments" --paginate \
    --jq '.[] | select(.user.login == "dogancanbakir" and (.body | contains("`@coderabbit` create an issue to track this pr"))) | .html_url' \
  | tail -n 1
)"

if [ -z "${comment_url}" ]; then
  echo "Could not locate the requester comment on ${pr_url}." >&2
  exit 1
fi

issue_body="$(cat <<EOF
## Summary

Track the dependency migration in PR #${pr_number}. The pull request replaces deprecated \`golang.org/x/exp/maps\` and \`golang.org/x/exp/slices\` usages with the Go standard-library \`maps\` and \`slices\` packages.

## Rationale

\`golangci-lint v2.12.2\` enables the \`govet\` inline analyzer. The analyzer reports inline errors for the deprecated experimental package usage.

## Affected areas

- \`go.mod\`
- \`pkg/passive/sources.go\`
- \`pkg/passive/sources_test.go\`
- \`pkg/passive/sources_wo_auth_test.go\`
- \`pkg/runner/stats.go\`

## Required changes

- Use the standard-library \`maps\` and \`slices\` packages.
- Replace direct equivalents such as \`maps.Copy\` and \`slices.Contains\`.
- Handle iterator-based \`maps.Keys\` and \`maps.Values\` results with \`slices.Collect\` or \`slices.Sorted\` where a slice is required.
- Keep \`golang.org/x/exp\` as an indirect dependency only when another dependency still requires it.

## Acceptance criteria

- The repository has no direct imports of \`golang.org/x/exp/maps\` or \`golang.org/x/exp/slices\`.
- Existing behavior and deterministic output ordering remain unchanged where required.
- The relevant \`golangci-lint\` inline analyzer errors no longer occur.

## Backlinks

- Pull request: ${pr_url}
- Request comment: ${comment_url}
- Requester: @${requester}
EOF
)"

issue_url="$(
  gh issue create \
    --repo "${repo}" \
    --title "Track migration from golang.org/x/exp maps and slices to the Go standard library" \
    --body "${issue_body}" \
    --assignee "${requester}"
)"

printf '%s\n' "${issue_url}"

Length of output: 2542


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="projectdiscovery/subfinder"
pr_number="1820"
requester="dogancanbakir"

echo "Issue comments:"
gh api "repos/${repo}/issues/${pr_number}/comments" --paginate \
  --jq ".[] | select(.user.login == \"${requester}\") | [.html_url, .body] | `@tsv`" || true

echo
echo "Review comments:"
gh api "repos/${repo}/pulls/${pr_number}/comments" --paginate \
  --jq ".[] | select(.user.login == \"${requester}\") | [.html_url, .body] | `@tsv`" || true

echo
echo "Pull request review summaries:"
gh api "repos/${repo}/pulls/${pr_number}/reviews" --paginate \
  --jq ".[] | select(.user.login == \"${requester}\") | [.html_url, .body, .state] | `@tsv`" || true

Length of output: 1010


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="projectdiscovery/subfinder"
requester="dogancanbakir"
pr_url="https://github.com/projectdiscovery/subfinder/pull/1820"
comment_url="https://github.com/projectdiscovery/subfinder/pull/1820#issuecomment-5193858664"

issue_body="$(cat <<EOF
## Summary

Track the dependency migration in PR `#1820`. The pull request replaces deprecated \`golang.org/x/exp/maps\` and \`golang.org/x/exp/slices\` usages with the Go standard-library \`maps\` and \`slices\` packages.

## Rationale

\`golangci-lint v2.12.2\` enables the \`govet\` inline analyzer. The analyzer reports inline errors for the deprecated experimental package usage.

## Affected areas

- \`go.mod\`
- \`pkg/passive/sources.go\`
- \`pkg/passive/sources_test.go\`
- \`pkg/passive/sources_wo_auth_test.go\`
- \`pkg/runner/stats.go\`

## Required changes

- Use the standard-library \`maps\` and \`slices\` packages.
- Replace direct equivalents such as \`maps.Copy\` and \`slices.Contains\`.
- Handle iterator-based \`maps.Keys\` and \`maps.Values\` results with \`slices.Collect\` or \`slices.Sorted\` where a slice is required.
- Keep \`golang.org/x/exp\` as an indirect dependency only when another dependency still requires it.

## Acceptance criteria

- The repository has no direct imports of \`golang.org/x/exp/maps\` or \`golang.org/x/exp/slices\`.
- Existing behavior and deterministic output ordering remain unchanged where required.
- The relevant \`golangci-lint\` inline analyzer errors no longer occur.

## Backlinks

- Pull request: ${pr_url}
- Request comment: ${comment_url}
- Requester: @${requester}
EOF
)"

gh issue create \
  --repo "${repo}" \
  --title "Track migration from golang.org/x/exp maps and slices to the Go standard library" \
  --body "${issue_body}" \
  --assignee "${requester}"

Length of output: 2001


@dogancanbakir Created and assigned tracking issue #1822: #1822

You are interacting with an AI system.

@dogancanbakir
dogancanbakir merged commit e63775c into dev Aug 5, 2026
9 checks passed
@dogancanbakir
dogancanbakir deleted the fix-lint-issues branch August 5, 2026 15:35
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
subfinder 2.15.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>## What's Changed

### 🎉 New Features
* Added shodanct passive source by @dogancanbakir in projectdiscovery/subfinder#1796
* Added Option `-vR`, `-virustotal-res` for VirusTotal source by @Bundy01 in projectdiscovery/subfinder#1719
* Added machine-readable source listing with `-ls -oJ` by @Gerijacki in projectdiscovery/subfinder#1812

### 🐞 Bug Fixes
* Fixed source leaks by @Mzack9999 in projectdiscovery/subfinder#1801
* Fixed drain source channels on cancel so source goroutines exit instead of leaking on a blocked send by @Mzack9999 in projectdiscovery/subfinder#1799
* Fixed crtsh's query by dropping unused certificate metadata from SQL query by @ChrisJr404 in projectdiscovery/subfinder#1787
* Fixed VirusTotal source by capping pagination and providing clearer 429 message by @ChrisJr404 in projectdiscovery/subfinder#1788
* Fixed Anubis source by switching subdomain API to anubisdb.com by @jatinder14 in projectdiscovery/subfinder#1815

### Other Changes
* Fixed lint issues by @dogancanbakir in projectdiscovery/subfinder#1820
* Refactored loadFromFile to use bufio.Scanner by @nandaanomi in projectdiscovery/subfinder#1791


## New Contributors
* @ChrisJr404 made their first contribution in projectdiscovery/subfinder#1787
* @Bundy01 made their first contribution in projectdiscovery/subfinder#1719
* @nandaanomi made their first contribution in projectdiscovery/subfinder#1791
* @jatinder14 made their first contribution in projectdiscovery/subfinder#1815
* @Gerijacki made their first contribution in projectdiscovery/subfinder#1812

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

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