Skip to content

fix: remove unused bsl parameter (golangci-lint unparam) - #1

Merged
msfrucht merged 2 commits into
msfrucht:cacertref_dptfrom
kaovilai:unparam-fix-2443
Oct 5, 2026
Merged

msfrucht merged 2 commits into
msfrucht:cacertref_dptfrom
kaovilai:unparam-fix-2443

Conversation

@kaovilai

Copy link
Copy Markdown

Fixes the golangci-lint unparam finding currently blocking CI on openshift#2443:

internal/controller/tls_config.go:39:59: buildTLSConfig - bsl is unused (unparam)

buildTLSConfig's bsl *velerov1.BackupStorageLocationSpec parameter was never read in the function body -- CA cert data is already passed separately via caCertData []byte. Removing it cascaded: buildHTTPClientWithTLS and buildAWSSessionWithTLS only forwarded bsl to buildTLSConfig, so removing it there surfaced the same lint violation one level up. Removed bsl from all 3 functions and updated the 2 real call sites plus 3 test call sites accordingly.

Verified locally:

  • go build ./...
  • go vet ./internal/controller/...
  • golangci-lint run ./internal/controller/... → 0 issues
  • go test ./internal/controller/... -run 'TestBuild|TLS|DataProtectionTest' → all pass, including the BSL-CA-cert test cases (confirms behavior is unchanged -- bsl truly carried no logic)

Feel free to squash into your own commits, or merge as-is.

…int unparam)

golangci-lint's unparam check flagged buildTLSConfig's bsl parameter as
unused -- CA cert data is already passed separately via caCertData
([]byte), so bsl was never read in the function body. Removing it
cascaded: buildHTTPClientWithTLS and buildAWSSessionWithTLS only
forwarded bsl to buildTLSConfig, so once removed there they also became
unparam violations, requiring the same removal all the way up through
their 2 real callers and 3 test call sites.

Verified: go build ./..., go vet ./internal/controller/...,
golangci-lint run ./internal/controller/... (0 issues), and
go test ./internal/controller/... -run 'TestBuild|TLS|DataProtectionTest'
(all pass, including the BSL-CA-cert test cases -- confirming bsl truly
carried no behavior).

Co-authored-by: Hermes Agent <noreply@hermes-agent>
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
Copilot AI balanced review requested due to automatic review settings September 30, 2026 20:34

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

The signature cleanup is behavior-preserving and all call sites are updated; only a minor comment typo remains.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Removes an unused BSL parameter from TLS helper functions to satisfy unparam linting without changing behavior.

Changes:

  • Simplifies three TLS helper signatures.
  • Updates controller and unit-test call sites.
  • Clarifies TLS certificate comments.
File Description
internal/​controller/​tls_config.go Removes unused BSL parameters.
internal/​controller/​dataprotectiontest_controller.go Updates production call sites.
internal/​controller/​dataprotectiontest_controller_test.go Updates test call sites.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/controller/tls_config.go Outdated
Copilot review finding on msfrucht#1: the comment wrote
'CaCertRef' but the actual DataProtectionApplication API field is
CACertRef (json tag caCertRef). Comment-only fix, no behavior change.

Co-authored-by: Hermes Agent <noreply@hermes-agent>
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
@msfrucht
msfrucht merged commit 3fb59de into msfrucht:cacertref_dpt Oct 5, 2026
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.

3 participants