Fix golangci-lint errors and enforce lint in CI#759
Open
aravindtga wants to merge 3 commits into
Open
Conversation
Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
b420db9 to
1d381f2
Compare
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR primarily addresses lint-related error handling for I/O operations and introduces path sanitization when reading resources from files.
Changes:
- Explicitly ignore or capture return values from
Close()/Fprint()/Fprintf()to satisfy error-checking linters. - Use
fmt.Fprintfin the property test generator to avoidfmt.Sprintfallocation. - Apply
filepath.Cleanbeforeos.ReadFilein file-mode execution.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| go/fn/run_flags_test.go | Updates test helpers to explicitly ignore Close() errors. |
| go/fn/run_filemode_property_test.go | Uses fmt.Fprintf into a buffer and ignores RemoveAll error in defer. |
| go/fn/run.go | Cleans file paths before reading; explicitly discards fmt.Fprint return values. |
| go/fn/internal/docs/render.go | Explicitly discards fmt.Fprint/Fprintf return values during help rendering. |
| go/Makefile | Ensures golangci-lint failures stop the lint-modules loop. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
a01fa97 to
6397b63
Compare
Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
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.
Description
errcheck,gosec,staticcheck) acrossgo/fnand added|| exit 1to thelint-modulesMakefile target so lint failures actually break CI.internal/docs/render.go: Explicitly discardfmt.Fprint/fmt.Fprintfreturn values with_, _ =run.go: Same forfmt.Fprintcalls; usefilepath.FromSlash+//nolint:gosecfor CLI-arg file reads_ =forClose()calls,fmt.Fprintfinstead ofWriteString(fmt.Sprintf(...)), wrapos.RemoveAllin closurego/Makefile: Add|| exit 1tolint-modulesloop so lint failures propagateRelated Issue(s)
Type of Change
Checklist
AI Disclosure
If so, please describe how:
- Kiro to identify and fix all golangci-lint errors and the CI gating issue.