Conversation
There was a problem hiding this comment.
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:goconstannotations for remaining literals. - Updates golangci-lint
goconstsettings (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.
| 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"} |
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.