Repository navigation
fix lint issues - #1820
fix lint issues#1820
Conversation
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughThe change replaces experimental map and slice utilities with standard-library packages in source handling, statistics, and tests. It preserves deterministic source ordering and moves ChangesStandard-library collection migration
Estimated code review effort: 1 (Trivial) | ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai create an issue to track this pr |
|
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
You are interacting with an AI system. |
|
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`" || trueLength 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
You are interacting with an AI system. |
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
Replace deprecated
golang.org/x/exp/mapsandgolang.org/x/exp/sliceswith the stdlibmapsandslices, fixing thegovetinline errors reported by golangci-lint v2.12.2.Summary by CodeRabbit