Skip to content

refactor: address goconst lint issues#1304

Open
rsdmike wants to merge 1 commit into
mainfrom
lint
Open

refactor: address goconst lint issues#1304
rsdmike wants to merge 1 commit into
mainfrom
lint

Conversation

@rsdmike
Copy link
Copy Markdown
Member

@rsdmike rsdmike commented May 1, 2026

No description provided.

Copilot AI review requested due to automatic review settings May 1, 2026 21:33
@rsdmike rsdmike enabled auto-merge (rebase) May 1, 2026 21:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors repeated string literals to address goconst lint findings across the CLI/orchestrator and activation flows, plus a small golangci-lint configuration tweak.

Changes:

  • Introduces shared constants for repeated literals (e.g., "ActivationFailed", "rpc", and JSON output keys in activation commands).
  • Adds targeted //nolint:goconst annotations for remaining literals.
  • Updates golangci-lint goconst settings (min-occurrences).

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/utils/constants.go Extracts "ActivationFailed" into a constant and reuses it across related CustomError definitions.
internal/orchestrator/orchestrator.go Introduces cmdRPC constant and uses it when building subprocess argument lists.
internal/orchestrator/executor.go Uses cmdRPC when determining/stripping the synthetic argv[0] placeholder.
internal/commands/diagnostics/wsman.go Adds //nolint:goconst on a WSMAN class name literal.
internal/commands/amtinfo.go Adds //nolint:goconst on status string literals in display styling logic.
internal/commands/activate/remote.go Replaces some JSON output keys with shared constants.
internal/commands/activate/local.go Replaces JSON output keys with shared constants; adds a goconst suppression on AMT status comparison.
internal/commands/activate/keys.go New file defining shared JSON key/value constants for activation output.
internal/cli/cli.go Adds constants for command name literals (e.g., amtinfo, version) and uses them in defaulting logic.
.golangci.yml Raises goconst min-occurrences from 3 to 5.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/utils/constants.go
WiredConfigurationFailed = CustomError{Code: 137, Message: "WiredConfigurationFailed"}
ActivationFailedCertHash = CustomError{Code: 138, Message: "ActivationFailed", Details: "leaf certificate hash too long"}
ActivationFailedCertHash = CustomError{Code: 138, Message: msgActivationFailed, Details: "leaf certificate hash too long"}
UnsupportedAMTVersion = CustomError{Code: 138, Message: "UnsupportedAMTVersion"}
Comment thread .golangci.yml
goconst:
min-len: 2
min-occurrences: 3
min-occurrences: 5
for attempt := 1; attempt <= hbcMaxAttempts; attempt++ {
response, err = service.startSecureHostBasedConfiguration(certsAndKeys)
if err == nil && response.Status == "AMT_STATUS_SUCCESS" {
if err == nil && response.Status == "AMT_STATUS_SUCCESS" { //nolint:goconst // AMT response status; remaining occurrences are in tests
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