-
Notifications
You must be signed in to change notification settings - Fork 1.6k
✨ (go/v4): scaffold kube-api-linter support in new projects #4941
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
base: master
Are you sure you want to change the base?
✨ (go/v4): scaffold kube-api-linter support in new projects #4941
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
444bd36 to
6bda013
Compare
85696c0 to
2f745c5
Compare
2f745c5 to
6a5c28f
Compare
6a5c28f to
96e5382
Compare
ecd247e to
8fcd00e
Compare
787744d to
3ca5994
Compare
3ca5994 to
08a0d45
Compare
Remove omitempty from JSON tags on nested struct fields such as metav1 ObjectMeta Status and metav1 ListMeta in API type scaffolds The omitempty tag has no effect on nested structs in Go and triggers linter warnings For Go version 1.24+ and later omitzero correctly handles nested structs and omits them when empty making omitempty redundant and misleading The optional markers already indicate optional fields for CRD schema generation Updated JSON tags: - metav1 ObjectMeta metadata omitempty omitzero becomes metadata omitzero - Status fields status omitempty omitzero becomes status omitzero - metav1 ListMeta metadata omitempty becomes metadata omitzero This resolves linter warnings from gopls modernize analyzer and kube api linter while maintaining correct behavior for projects using Go 1.24+ Signed-off-by: Camila Macedo <7708031+camilamacedo86@users.noreply.github.com>
2baf23a to
93ca425
Compare
|
@camilamacedo86: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
.custom-gcl.yml, adds Makefile and CI hooks, and enables thekubeapilintermodule in.golangci.ymlso every new operator starts with CRD-focused linting out of the box.optionalfieldspointer policy defaults toWhenRequired, matching the kube-api-linter maintainers’ recommendation for CRDs and avoiding the stricter setting that targets core Kubernetes API types (kube-api-linter#128).Closes: #4809