Skip to content

fix(lint): resolve unparam findings - #892

Merged
skevetter merged 2 commits into
mainfrom
lint/unparam-findings
Aug 7, 2026
Merged

fix(lint): resolve unparam findings#892
skevetter merged 2 commits into
mainfrom
lint/unparam-findings

Conversation

@skevetter

@skevetter skevetter commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Resolves all 11 unparam findings by removing unused return values / constant-valued params and updating every call site.

Fixed, real signature simplification:

  • pkg/copy/copy.go: parseUserSpec drops its unused group return.
  • pkg/daemon/platform/local_server.go: newLocalServer/watchPlatform drop their always-nil error returns (unexported, single caller each). ListenAndServe's stopChan-based shutdown synchronization is unaffected — verified by reading the full select/close path.
  • pkg/driver/kubernetes/init_container.go: getInitContainers drops its always-nil error return.
  • pkg/driver/kubernetes/registry.go: validateIndexName drops its always-nil error return, propagated into newIndexInfo (its only caller — became always-nil as a direct consequence, not in the original 11 but needed to keep unparam at 0).
  • pkg/platform/kubeconfig.go: newKubeConfig drops insecure — all 4 call sites pass true.
  • pkg/telemetry/collect.go: newCLICollector drops its always-nil error return.
  • pkg/workspace/list.go: listProWorkspaces drops its always-nil error return, propagated into reconcileProWorkspaces (its only caller, same reasoning as newIndexInfo).
  • e2e/tests/up-docker-compose/helper.go: getAppContainer drops its unused ids return; setupDockerProvider drops dockerPath (always "docker" across all 5 call sites in this package).

Suppressed, with reason:

  • e2e/tests/up-features/helper.go: setupDockerProvider's dockerPath looks constant from every non-Windows call site, but wsl.go — a windows-only (//go:build windows) file in the same package — calls it with "podman". Removing the param would break the Windows build (confirmed with GOOS=windows go build ./e2e/..., both before and after my change). Added //nolint:unparam noting this.

golangci-lint run --enable-only=unparam --max-same-issues=0 ./... now reports 0 issues. go build, go vet (aside from one pre-existing, unrelated pkg/pty/ptytest finding), and tests for every touched package all pass.

Summary by CodeRabbit

  • Refactor
    • Simplified Docker, Kubernetes, workspace, and local server initialization flows.
    • Streamlined container, registry, user specification, and telemetry processing.
  • Bug Fixes
    • Improved Docker container lookup handling.
    • Workspace listings now continue using available results when provider issues occur.
    • Simplified Kubernetes connection configuration and initialization behavior.
    • Reduced unnecessary failures during platform, workspace, and telemetry startup operations.

@netlify

netlify Bot commented Aug 6, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit d00b4c3
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a755ab26979570009c3b3d8

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

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: 083ee5d1-973f-4832-8324-eb986eef7c2d

📥 Commits

Reviewing files that changed from the base of the PR and between bd85187 and d00b4c3.

📒 Files selected for processing (14)
  • e2e/tests/up-docker-compose/build.go
  • e2e/tests/up-docker-compose/config.go
  • e2e/tests/up-docker-compose/helper.go
  • e2e/tests/up-docker-compose/up_docker_compose.go
  • e2e/tests/up-features/helper.go
  • pkg/copy/copy.go
  • pkg/daemon/platform/daemon.go
  • pkg/daemon/platform/local_server.go
  • pkg/driver/kubernetes/init_container.go
  • pkg/driver/kubernetes/registry.go
  • pkg/driver/kubernetes/run.go
  • pkg/platform/kubeconfig.go
  • pkg/telemetry/collect.go
  • pkg/workspace/list.go
🚧 Files skipped from review as they are similar to previous changes (13)
  • e2e/tests/up-docker-compose/up_docker_compose.go
  • pkg/daemon/platform/daemon.go
  • e2e/tests/up-features/helper.go
  • pkg/driver/kubernetes/registry.go
  • pkg/telemetry/collect.go
  • pkg/workspace/list.go
  • pkg/daemon/platform/local_server.go
  • e2e/tests/up-docker-compose/config.go
  • e2e/tests/up-docker-compose/build.go
  • pkg/platform/kubeconfig.go
  • pkg/driver/kubernetes/run.go
  • e2e/tests/up-docker-compose/helper.go
  • pkg/copy/copy.go

📝 Walkthrough

Walkthrough

The change simplifies Go function contracts by removing unused values and always-nil errors. Docker E2E helpers now use fixed provider setup and return required container data. Kubernetes, platform, telemetry, workspace, and copy callers use the updated contracts.

Changes

Docker E2E helper contracts

Layer / File(s) Summary
Docker provider setup contract
e2e/tests/up-docker-compose/*.go, e2e/tests/up-features/helper.go
setupDockerProvider now accepts only the binary directory and uses docker internally. Callers and the lint annotation reflect the updated contract.
Container inspection result contract
e2e/tests/up-docker-compose/config.go, e2e/tests/up-docker-compose/helper.go
getAppContainer now returns only the inspected container and its error. Verification and container-detail tests use the reduced result.

Runtime return contract simplification

Layer / File(s) Summary
User specification parsing
pkg/copy/copy.go
parseUserSpec returns only the user portion. Chown and ChownR use the single result.
Local server lifecycle returns
pkg/daemon/platform/daemon.go, pkg/daemon/platform/local_server.go
Local server construction and platform watching no longer return errors. ListenAndServe reports watcher completion with nil.
Kubernetes container and registry helpers
pkg/driver/kubernetes/init_container.go, pkg/driver/kubernetes/registry.go, pkg/driver/kubernetes/run.go
Kubernetes helpers return direct values. Pod construction and registry lookup no longer handle helper errors.
Kubeconfig construction contract
pkg/platform/kubeconfig.go
newKubeConfig no longer accepts an insecure flag and always enables InsecureSkipTLSVerify.
CLI collector initialization
pkg/telemetry/collect.go
newCLICollector returns the collector directly. BootstrapCLI removes initialization error handling and noop fallback logic.
Workspace reconciliation results
pkg/workspace/list.go
Workspace reconciliation returns workspace data directly. Provider errors remain stored in per-provider result entries.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • devsy-org/devsy#20: Both PRs modify Docker E2E setup files and pkg/daemon/platform/local_server.go.
  • devsy-org/devsy#720: Both PRs modify pkg/driver/kubernetes/run.go and pkg/workspace/list.go.
  • devsy-org/devsy#876: Both PRs modify pkg/daemon/platform/local_server.go, including watchPlatform.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: resolving unparam lint findings across the codebase.
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.

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.

@netlify

netlify Bot commented Aug 6, 2026

Copy link
Copy Markdown

Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit d00b4c3
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6a755ab2d2ad4800083d0a99

@github-actions github-actions Bot added the size/m label Aug 6, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e/tests/up-docker-compose/helper.go`:
- Around line 113-116: Update the error branch in verifyWorkspaceMount so a
successful findComposeContainer call with no IDs is handled as an error rather
than returning nil, nil; remove the len(ids) == 0 condition and allow
inspectContainer to produce its existing error, or return an explicit error
before dereferencing the container detail.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f63904b0-a707-40fc-976c-35039e1c86f4

📥 Commits

Reviewing files that changed from the base of the PR and between ffb6784 and 8a8a5de.

📒 Files selected for processing (14)
  • e2e/tests/up-docker-compose/build.go
  • e2e/tests/up-docker-compose/config.go
  • e2e/tests/up-docker-compose/helper.go
  • e2e/tests/up-docker-compose/up_docker_compose.go
  • e2e/tests/up-features/helper.go
  • pkg/copy/copy.go
  • pkg/daemon/platform/daemon.go
  • pkg/daemon/platform/local_server.go
  • pkg/driver/kubernetes/init_container.go
  • pkg/driver/kubernetes/registry.go
  • pkg/driver/kubernetes/run.go
  • pkg/platform/kubeconfig.go
  • pkg/telemetry/collect.go
  • pkg/workspace/list.go

Comment thread e2e/tests/up-docker-compose/helper.go
@skevetter
skevetter marked this pull request as draft August 7, 2026 01:18
Removed unused return values and constant-valued parameters across 9
findings, updating every call site:

- pkg/copy/copy.go: parseUserSpec drops its unused group return.
- pkg/daemon/platform/local_server.go: newLocalServer and watchPlatform
  drop their always-nil error returns (unexported, single callers);
  ListenAndServe/Close synchronization via stopChan is unaffected.
- pkg/driver/kubernetes/init_container.go: getInitContainers drops its
  always-nil error return.
- pkg/driver/kubernetes/registry.go: validateIndexName drops its
  always-nil error return; propagated into newIndexInfo (its only
  caller), which had the same always-nil pattern once validateIndexName's
  signature simplified -- not in the original 11 but a direct consequence
  of this fix, so simplified alongside to keep the lint run clean.
- pkg/platform/kubeconfig.go: newKubeConfig drops its always-true
  insecure param (InsecureSkipTLSVerify is always true across its 4
  call sites; no test coverage depends on making it configurable).
- pkg/telemetry/collect.go: newCLICollector drops its always-nil error
  return (analytics.NewClient() cannot fail).
- pkg/workspace/list.go: listProWorkspaces drops its always-nil error
  return; propagated into reconcileProWorkspaces (its only caller, whose
  own error return became always-nil as a result) for the same reason
  as newIndexInfo above.
- e2e/tests/up-docker-compose/helper.go: getAppContainer drops its
  unused ids return; setupDockerProvider drops its always-"docker"
  dockerPath param (all 5 call sites in this package use "docker").

Suppressed rather than fixed:
- e2e/tests/up-features/helper.go: setupDockerProvider's dockerPath
  looks constant ("docker") from every non-Windows call site, but
  wsl.go (a windows-only build-tagged file in the same package) calls
  it with "podman". Verified with GOOS=windows go build. Added
  //nolint:unparam noting the windows-only caller.

go build, go vet (aside from a pre-existing, unrelated ptytest.go vet
finding), and tests for every touched package all pass. Also verified
GOOS=windows go build ./e2e/... to confirm the up-features suppression.
- getAppContainer no longer returns (nil, nil) when the compose
  container lookup succeeds with zero IDs; it now falls through to
  inspectContainer, which already errors on an empty ID list. This
  fixes a latent nil-pointer panic in verifyWorkspaceMount and the
  container-detail assertions in config.go.
- Update newIndexInfo's comment to reflect that it now returns a
  normalized registry name string, not an IndexInfo struct.
@skevetter
skevetter force-pushed the lint/unparam-findings branch from 75cf1fc to d00b4c3 Compare August 7, 2026 04:10
@skevetter
skevetter marked this pull request as ready for review August 7, 2026 05:46
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@skevetter
skevetter merged commit 49e1812 into main Aug 7, 2026
67 checks passed
@skevetter
skevetter deleted the lint/unparam-findings branch August 7, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant