-
Notifications
You must be signed in to change notification settings - Fork 187
Fix golang lint failures: unchecked errors and disable ST1005 check #902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: simihablo <[email protected]>
|
@copilot, I want the capitalization of words left as-is. I want staticcheck ST1005 (lowercase error strings) to be permanently and globally disabled. Do this and revert the recent lowercasing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses failing Golang lint checks by fixing staticcheck ST1005 violations (error messages should start with lowercase), errcheck violations (unhandled error returns), and a QF1001 violation (unnecessary double negation).
Key changes:
- Lowercase error message strings across multiple files to comply with Go style guide
- Add explicit error handling for
os.RemoveAllcleanup operations - Simplify negation logic in test assertion
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| utils/manifests/utils.go | Lowercased 5 error messages in CueCrdFilter extractors |
| utils/cue.go | Lowercased error message in Lookup function |
| utils/component/generator_test.go | Simplified double negation !(a == b) to a != b |
| models/registration/utils.go | Lowercased 4 error messages in getEntity function |
| models/registration/dir.go | Added explicit error handling for os.RemoveAll in defer cleanup |
| models/controllers/meshery_broker.go | Lowercased error message in GetPublicEndpoint function |
| generators/github/git_repo.go | Added error handling for os.RemoveAll and lowercased error message |
| generators/artifacthub/package.go | Lowercased 4 error messages in UpdatePackageData function |
| files/sanitization.go | Lowercased 2 error messages in SanitizeBundle function |
| files/identification.go | Lowercased 2 error messages in parsing functions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]> Signed-off-by: Lee Calcote <[email protected]>
|
Ditto. @copilot, make sure that the capitalization of words are left as-is. Disable staticcheck ST1005 (lowercase error strings) check permanently and globally. Do this and revert proposed lowercasing changes. |
I've reverted all the error string capitalization changes and added configuration to disable the ST1005 check in Changes in commit 88ab48e:
Note: There appears to be a caching issue with golangci-lint v2.7.2 where the ST1005 exclusion doesn't always apply when running on all packages ( |
- Reverted all lowercase error string changes to preserve original capitalization - Added .golangci.yml configuration to disable staticcheck ST1005 rule permanently - Kept errcheck fixes for os.RemoveAll calls (generators/github/git_repo.go, models/registration/dir.go) - Kept QF1001 fix for test assertion simplification (utils/component/generator_test.go) Co-authored-by: leecalcote <[email protected]>
Done in commit 5eee5fa. All error string capitalization has been reverted to preserve the original formatting, and I've added .golangci.yml configuration to permanently disable the ST1005 check globally. The errcheck and QF1001 fixes have been kept as they address actual code quality issues. |
Resolves golang lint violations while preserving original error message formatting per project preference.
Changes
errcheck violations: Added explicit handling for
os.RemoveAllreturn values in cleanup pathsgenerators/github/git_repo.gomodels/registration/dir.goST1005 check disabled: Added
.golangci.ymlconfiguration to permanently and globally disable the ST1005 staticcheck rule (error string capitalization). All error strings preserve their original capitalization as per project style.linters-settings.staticcheck.checks: ["all", "-ST1005"]issues.exclude: ["ST1005"]QF1001 violation: Simplified double negation in test assertion
All changes preserve existing behavior and original error message formatting. Total diff: 4 files changed with golangci-lint configuration updated to exclude ST1005 checks globally.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.