Use golangci-lint v2, migrate config and adjust Makefile#4477
Use golangci-lint v2, migrate config and adjust Makefile#4477efiacor merged 5 commits intokptdev:mainfrom
Conversation
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
✅ Deploy Preview for kptdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Migrates the repo to golangci-lint v2 and updates the lint configuration/Makefile, along with a set of small Go code refactors to satisfy new/updated linter checks.
Changes:
- Update
.golangci.ymlto the v2 config format and adjust enabled linters/exclusions. - Update
Makefileto install/run golangci-lint v2 and add a conditional path to use a local binary when available. - Apply lint-driven refactors/cleanups across multiple Go packages (simplified boolean logic, metadata field access, and
fmt.Fprintfusage with builders).
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/wasm/client.go | Adjusts the image push reference used for remote.Write. |
| pkg/live/rgstream.go | Fixes Kptfile type detection by comparing the correct TypeMeta field. |
| pkg/live/rgpath.go | Removes a nolint directive/comment near kyamlNodeToUnstructured. |
| pkg/live/planner/cluster.go | Simplifies action-type filtering boolean logic. |
| pkg/lib/errors/resolver/live.go | Replaces Sprintf+WriteString with Fprintf into a builder. |
| pkg/api/kptfile/v1/validation.go | Replaces Sprintf+WriteString with Fprintf into a builder. |
| internal/util/update/update.go | Simplifies negated equality boolean expression. |
| internal/util/strings/strings.go | Switches to fmt.Fprintf into a builder for quoted joins. |
| internal/testutil/pkgbuilder/builder.go | Uses promoted metadata fields (Name, Namespace, etc.) instead of ObjectMeta.*. |
| internal/pkg/pkg.go | Simplifies ResourceGroup filter boolean logic. |
| internal/fnruntime/fnerrors.go | Replaces Sprintf+WriteString with Fprintf into a builder. |
| commands/live/migrate/migratecmd_test.go | Updates tests to use promoted metadata fields (Namespace, Name, Labels). |
| commands/alpha/live/plan/command.go | Simplifies output-format validation boolean logic. |
| Makefile | Pins golangci-lint v2, adds bash shell settings, and changes lint to use local binary when matching version. |
| .golangci.yml | Migrates golangci-lint config to v2 schema; updates linters, settings, and exclusion rules/paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
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 migrates the project to golangci-lint v2 (v2.11.4), updates lint configuration to the v2 schema, and applies code tweaks needed to satisfy new/updated linters.
Changes:
- Update
Makefileto install/run golangci-lint v2.11.4 and optimizemake lintexecution. - Migrate
.golangci.ymlto golangci-lint v2 configuration format, including formatter configuration and exclusions. - Apply small refactors across Go code to satisfy new lint rules (e.g., boolean logic simplifications, more efficient string building, struct field promotion).
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/wasm/client.go | Update push reference construction for remote image write. |
| pkg/live/rgstream.go | Adjust Kptfile type detection to match updated struct shape. |
| pkg/live/rgpath.go | Remove prior //nolint:interfacer suppression. |
| pkg/live/planner/cluster.go | Simplify action filtering boolean logic. |
| pkg/lib/errors/resolver/live.go | Replace Sprintf+WriteString with Fprintf to builder. |
| pkg/api/kptfile/v1/validation.go | Use Fprintf for error string assembly. |
| internal/util/update/update.go | Simplify boolean expression. |
| internal/util/strings/strings.go | Use strconv.Quote instead of fmt.Sprintf("%q", ...). |
| internal/testutil/pkgbuilder/builder.go | Use promoted metadata fields (Name, Namespace, etc.). |
| internal/pkg/pkg.go | Simplify boolean logic for ResourceGroup filtering. |
| internal/fnruntime/fnerrors.go | Use Fprintf for builder formatting. |
| commands/live/migrate/migratecmd_test.go | Update tests to use promoted metadata fields. |
| commands/alpha/live/plan/command.go | Simplify output-format validation boolean logic. |
| Makefile | Add golangci-lint v2 version pin + conditional invocation logic. |
| .golangci.yml | Migrate configuration to golangci-lint v2 schema; add formatter config and updated exclusions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Part of #4389
Migrated to golangci-lint v2 (specifically v2.11.4), fixed some new linter issues and adjusted the Makefile.