Skip to content

chore(ci): upgrade golangci-lint to v2 - #1420

Merged
dwisiswant0 merged 3 commits into
projectdiscovery:devfrom
jmoneill-snyk:chore/golangci-lint-v2
Sep 9, 2026
Merged

dwisiswant0 merged 3 commits into
projectdiscovery:devfrom
jmoneill-snyk:chore/golangci-lint-v2

Conversation

@jmoneill-snyk

@jmoneill-snyk jmoneill-snyk commented Sep 9, 2026

Copy link
Copy Markdown

Summary

  • Upgrade lint CI to golangci-lint v2.4.0 with pinned version and explicit config
  • Modernize workflow: setup-go reads from go.mod, golangci-lint-action@v8
  • Fix pre-existing lint findings so CI passes on current main

This PR should merge before #1419. Once merged, rebase the ACME fix onto updated main — the Go 1.25 bump in #1419 will then lint cleanly.

Test plan

  • golangci-lint run --timeout 5m passes locally (0 issues)
  • go test ./pkg/storage/... passes
  • CI Lint Test passes on this PR

Made with Cursor

Summary by CodeRabbit

  • Chores

    • Pinned code-quality tooling to a specific version for more consistent validation.
  • Refactor

    • Simplified internal diagnostic, health-check, and request logging output generation without changing reported information or behavior.
  • Tests

    • Improved test cleanup handling by explicitly ignoring expected resource-closing errors.
    • Added documentation for selected test helpers and scenarios while preserving existing assertions and execution behavior.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 3e55ce11-cc2a-4ea4-b6e6-88e0262e7ede

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 647f5e4c-1d1f-4352-84c3-74163487d337

📥 Commits

Reviewing files that changed from the base of the PR and between dd9a62d and 67c8a62.

📒 Files selected for processing (3)
  • pkg/server/ldap_server.go
  • pkg/storage/roundtrip_test.go
  • pkg/storage/storagedb_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • pkg/storage/storagedb_test.go
  • pkg/server/ldap_server.go
  • pkg/storage/roundtrip_test.go

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


Walkthrough

The change pins golangci-lint, replaces intermediate formatting allocations with direct builder writes, and makes ignored cleanup errors explicit in storage tests. Runtime output and test behavior remain unchanged.

Changes

Formatting and cleanup

Layer / File(s) Summary
Runtime formatted output
cmd/interactsh-server/main.go, internal/runner/healthcheck.go, pkg/server/ldap_server.go
Diagnostic and LDAP log messages now use fmt.Fprintf or fmt.Fprint directly with string builders.
Deferred test cleanup
pkg/storage/roundtrip_test.go, pkg/storage/storagedb_test.go
Deferred cleanup calls now use anonymous functions that explicitly ignore returned errors.
Lint version pin
.golangci-lint-version
The repository now pins golangci-lint to v2.4.0.

Priority: ⬇️ Low

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

Merge Risk: ⚪ Minimal · up to 67c8a

This change pins lint tooling and performs formatting and test-cleanup updates without an identified runtime behavior regression. No merge-blocking risk is currently established.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 84.62% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 5 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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: upgrading golangci-lint to v2. The title is concise and relevant to the changeset.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

A rabbit formats strings with care
Direct into builders, light as air
Cleanup errors softly fade
Lint version firmly stays
Tests hop on, unchanged and sound

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

jmoneill-snyk added a commit to jmoneill-snyk/interactsh that referenced this pull request Sep 9, 2026
Document touched test helpers and functions so docstring coverage meets
the 80% pre-merge check on projectdiscovery#1420.

Co-authored-by: Cursor <cursoragent@cursor.com>
@dwisiswant0
dwisiswant0 changed the base branch from main to dev September 9, 2026 22:15
jmoneill-snyk and others added 3 commits September 10, 2026 05:22
Migrate the lint workflow to golangci-lint v2.4.0 with a pinned version
and explicit config, and resolve pre-existing findings so CI passes on
current main. Intended to merge before the Go 1.25 ACME fix in projectdiscovery#1419.

Co-authored-by: Cursor <cursoragent@cursor.com>
Document touched test helpers and functions so docstring coverage meets
the 80% pre-merge check on projectdiscovery#1420.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Dwi Siswanto <git@dw1.io>
@dwisiswant0
dwisiswant0 force-pushed the chore/golangci-lint-v2 branch from 67c8a62 to 30fc9d4 Compare September 9, 2026 22:24
@dwisiswant0
dwisiswant0 merged commit 611647a into projectdiscovery:dev Sep 9, 2026
9 checks passed
@dwisiswant0

Copy link
Copy Markdown
Member

@coderabbitai create an issue to track this, make it short, one paragraph. read this PR body for the context.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="projectdiscovery/interactsh"
pr_number="1420"
pr_url="https://github.com/projectdiscovery/interactsh/pull/1420"

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

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

body="After `#1420` merges, run and verify the lint CI workflow with the pinned golangci-lint v2.4.0 configuration, `actions/setup-go` reading `go.mod`, and `golangci/golangci-lint-action@v8`; resolve any CI-only lint or configuration failures, then confirm the workflow passes so `#1419` can rebase on the updated `main`. Requested by `@dwisiswant0`. Context: ${pr_url}; request: ${comment_url}."

gh issue create \
  --repo "$repo" \
  --title "Validate golangci-lint v2 CI migration" \
  --assignee "dwisiswant0" \
  --body "$body"

Length of output: 1711


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="projectdiscovery/interactsh"
pr_number="1420"
pr_url="https://github.com/projectdiscovery/interactsh/pull/1420"

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

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

body=$(cat <<'EOF'
After `#1420` merges, run and verify the lint CI workflow with the pinned golangci-lint v2.4.0 configuration, `actions/setup-go` reading `go.mod`, and `golangci/golangci-lint-action@v8`; resolve any CI-only lint or configuration failures, then confirm the workflow passes so `#1419` can rebase on the updated `main`. Requested by `@dwisiswant0`.
EOF
)
body="${body} Context: ${pr_url}; request: ${comment_url}."

gh issue create \
  --repo "$repo" \
  --title "Validate golangci-lint v2 CI migration" \
  --assignee "dwisiswant0" \
  --body "$body"

Length of output: 1234


@dwisiswant0 Created #1422 to track CI validation for the golangci-lint v2 migration.

You are interacting with an AI system.

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