-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
✨ chore: add ginkgolinter #3894
Conversation
Welcome @PG2000! |
Hi @PG2000. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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/test-infra repository. |
/ok-to-test |
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.
Thank you for the contribution 🥇
I think we also need to:
- a) add to Kubebuilder code
Can you please add it to: https://github.com/kubernetes-sigs/kubebuilder/blob/master/.golangci.yml
- b) After any change in the scaffolds we MUST to run make generate.
This PR will fail in the check testdata sample since the samples under testdata and used for the docs are not updated with the change.
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.
It still missing:
a) You run make generate so that your changes are applied in the samples
b) Please squash all commits so that we can get it merge
Unfortunately Console ouput➜ kubebuilder git:(patch-1) ✗ make generate
go: creating new go.mod: module sigs.k8s.io/kubebuilder/testdata/project-v2
[Deprecation Notice] This version is deprecated and is no longer scaffolded by default since `28 Apr 2021`.The `go/v2` plugin cannot scaffold projects in which CRDs and/or Webhooks have a `v1` API version.Be aware that v1beta1 API for CRDs and Webhooks was deprecated on Kubernetes 1.16 and areremoved as of the Kubernetes 1.22 release. Therefore, since this plugin cannot produce projects thatwork on Kubernetes versions >= 1.22, it is recommended to upgrade your project to the latest versions available.
INFO Writing scaffold for you to edit...
INFO Get controller runtime:
$ go get sigs.k8s.io/[email protected]
INFO Update dependencies:
$ go mod tidy
[Deprecation Notice] This version is deprecated and is no longer scaffolded by default since `28 Apr 2021`.The `go/v2` plugin cannot scaffold projects in which CRDs and/or Webhooks have a `v1` API version.Be aware that v1beta1 API for CRDs and Webhooks was deprecated on Kubernetes 1.16 and areremoved as of the Kubernetes 1.22 release. Therefore, since this plugin cannot produce projects thatwork on Kubernetes versions >= 1.22, it is recommended to upgrade your project to the latest versions available.
INFO Writing scaffold for you to edit...
INFO api/v1/captain_types.go
INFO controllers/captain_controller.go
INFO Update dependencies:
$ go mod tidy
[Deprecation Notice] This version is deprecated and is no longer scaffolded by default since `28 Apr 2021`.The `go/v2` plugin cannot scaffold projects in which CRDs and/or Webhooks have a `v1` API version.Be aware that v1beta1 API for CRDs and Webhooks was deprecated on Kubernetes 1.16 and areremoved as of the Kubernetes 1.22 release. Therefore, since this plugin cannot produce projects thatwork on Kubernetes versions >= 1.22, it is recommended to upgrade your project to the latest versions available.
INFO Writing scaffold for you to edit...
INFO api/v1/captain_types.go
INFO controllers/captain_controller.go
INFO Update dependencies:
$ go mod tidy
[Deprecation Notice] This version is deprecated and is no longer scaffolded by default since `28 Apr 2021`.The `go/v2` plugin cannot scaffold projects in which CRDs and/or Webhooks have a `v1` API version.Be aware that v1beta1 API for CRDs and Webhooks was deprecated on Kubernetes 1.16 and areremoved as of the Kubernetes 1.22 release. Therefore, since this plugin cannot produce projects thatwork on Kubernetes versions >= 1.22, it is recommended to upgrade your project to the latest versions available.
INFO Writing scaffold for you to edit...
INFO api/v1/captain_webhook.go
[Deprecation Notice] This version is deprecated and is no longer scaffolded by default since `28 Apr 2021`.The `go/v2` plugin cannot scaffold projects in which CRDs and/or Webhooks have a `v1` API version.Be aware that v1beta1 API for CRDs and Webhooks was deprecated on Kubernetes 1.16 and areremoved as of the Kubernetes 1.22 release. Therefore, since this plugin cannot produce projects thatwork on Kubernetes versions >= 1.22, it is recommended to upgrade your project to the latest versions available.
INFO Writing scaffold for you to edit...
INFO api/v1/firstmate_types.go
INFO controllers/firstmate_controller.go
INFO Update dependencies:
$ go mod tidy
[Deprecation Notice] This version is deprecated and is no longer scaffolded by default since `28 Apr 2021`.The `go/v2` plugin cannot scaffold projects in which CRDs and/or Webhooks have a `v1` API version.Be aware that v1beta1 API for CRDs and Webhooks was deprecated on Kubernetes 1.16 and areremoved as of the Kubernetes 1.22 release. Therefore, since this plugin cannot produce projects thatwork on Kubernetes versions >= 1.22, it is recommended to upgrade your project to the latest versions available.
INFO Writing scaffold for you to edit...
INFO api/v1/firstmate_webhook.go
[Deprecation Notice] This version is deprecated and is no longer scaffolded by default since `28 Apr 2021`.The `go/v2` plugin cannot scaffold projects in which CRDs and/or Webhooks have a `v1` API version.Be aware that v1beta1 API for CRDs and Webhooks was deprecated on Kubernetes 1.16 and areremoved as of the Kubernetes 1.22 release. Therefore, since this plugin cannot produce projects thatwork on Kubernetes versions >= 1.22, it is recommended to upgrade your project to the latest versions available.
INFO Writing scaffold for you to edit...
INFO api/v1/admiral_types.go
INFO controllers/admiral_controller.go
INFO Update dependencies:
$ go mod tidy
[Deprecation Notice] This version is deprecated and is no longer scaffolded by default since `28 Apr 2021`.The `go/v2` plugin cannot scaffold projects in which CRDs and/or Webhooks have a `v1` API version.Be aware that v1beta1 API for CRDs and Webhooks was deprecated on Kubernetes 1.16 and areremoved as of the Kubernetes 1.22 release. Therefore, since this plugin cannot produce projects thatwork on Kubernetes versions >= 1.22, it is recommended to upgrade your project to the latest versions available.
INFO Writing scaffold for you to edit...
INFO api/v1/admiral_webhook.go
[Deprecation Notice] This version is deprecated and is no longer scaffolded by default since `28 Apr 2021`.The `go/v2` plugin cannot scaffold projects in which CRDs and/or Webhooks have a `v1` API version.Be aware that v1beta1 API for CRDs and Webhooks was deprecated on Kubernetes 1.16 and areremoved as of the Kubernetes 1.22 release. Therefore, since this plugin cannot produce projects thatwork on Kubernetes versions >= 1.22, it is recommended to upgrade your project to the latest versions available.
INFO Writing scaffold for you to edit...
INFO controllers/laker_controller.go
INFO Update dependencies:
$ go mod tidy
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x59c72de]
goroutine 121 [running]:
go/types.(*Checker).handleBailout(0xc0002a8c00, 0xc000a33d40)
/usr/local/Cellar/go/1.22.0/libexec/src/go/types/check.go:367 +0x88
panic({0x5c887c0?, 0x6204200?})
/usr/local/Cellar/go/1.22.0/libexec/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0x5d4abc8, 0x620c460})
/usr/local/Cellar/go/1.22.0/libexec/src/go/types/sizes.go:228 +0x31e
go/types.(*Config).sizeof(...)
/usr/local/Cellar/go/1.22.0/libexec/src/go/types/sizes.go:333
go/types.representableConst.func1({0x5d4abc8?, 0x620c460?})
/usr/local/Cellar/go/1.22.0/libexec/src/go/types/const.go:76 +0x9e
go/types.representableConst({0x5d50998, 0x61d9380}, 0xc0002a8c00, 0x620c460, 0x0)
/usr/local/Cellar/go/1.22.0/libexec/src/go/types/const.go:92 +0x192
go/types.(*Checker).arrayLength(0xc0002a8c00, {0x5d4ee70, 0xc000a6db80?})
/usr/local/Cellar/go/1.22.0/libexec/src/go/types/typexpr.go:510 +0x2d3
go/types.(*Checker).typInternal(0xc0002a8c00, {0x5d4d760, 0xc000f26a80}, 0x0)
/usr/local/Cellar/go/1.22.0/libexec/src/go/types/typexpr.go:299 +0x49d
go/types.(*Checker).definedType(0xc0002a8c00, {0x5d4d760, 0xc000f26a80}, 0xc000a33328?)
/usr/local/Cellar/go/1.22.0/libexec/src/go/types/typexpr.go:180 +0x37
go/types.(*Checker).varType(0xc0002a8c00, {0x5d4d760, 0xc000f26a80})
/usr/local/Cellar/go/1.22.0/libexec/src/go/types/typexpr.go:145 +0x25
go/types.(*Checker).structType(0xc0002a8c00, 0xc000f3ca50, 0xc000f3ca50?)
/usr/local/Cellar/go/1.22.0/libexec/src/go/types/struct.go:113 +0x19f
go/types.(*Checker).typInternal(0xc0002a8c00, {0x5d4d6d0, 0xc000ae5a40}, 0xc000f24ff0)
/usr/local/Cellar/go/1.22.0/libexec/src/go/types/typexpr.go:316 +0x1345
go/types.(*Checker).definedType(0xc0002a8c00, {0x5d4d6d0, 0xc000ae5a40}, 0x5ae17d0?)
/usr/local/Cellar/go/1.22.0/libexec/src/go/types/typexpr.go:180 +0x37
go/types.(*Checker).typeDecl(0xc0002a8c00, 0xc000f24ff0, 0xc000f32100, 0x0)
/usr/local/Cellar/go/1.22.0/libexec/src/go/types/decl.go:615 +0x44d
go/types.(*Checker).objDecl(0xc0002a8c00, {0x5d55758, 0xc000f24ff0}, 0x0)
/usr/local/Cellar/go/1.22.0/libexec/src/go/types/decl.go:197 +0xa7f
go/types.(*Checker).packageObjects(0xc0002a8c00)
/usr/local/Cellar/go/1.22.0/libexec/src/go/types/resolver.go:681 +0x425
go/types.(*Checker).checkFiles(0xc0002a8c00, {0xc001080708, 0x3, 0x3})
/usr/local/Cellar/go/1.22.0/libexec/src/go/types/check.go:408 +0x1a5
go/types.(*Checker).Files(...)
/usr/local/Cellar/go/1.22.0/libexec/src/go/types/check.go:372
sigs.k8s.io/controller-tools/pkg/loader.(*loader).typeCheck(0xc0001fa990, 0xc000e7fae0)
/Users/pg2000/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/loader.go:283 +0x35b
sigs.k8s.io/controller-tools/pkg/loader.(*Package).NeedTypesInfo(0xc000e7fae0)
/Users/pg2000/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/loader.go:96 +0x39
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check(0xc000b92450, 0xc000e7fae0)
/Users/pg2000/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:249 +0x277
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check.func1(0x59?)
/Users/pg2000/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:243 +0x53
created by sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check in goroutine 83
/Users/pg2000/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:241 +0x18c
make[1]: *** [generate] Error 2
make: *** [generate-testdata] Error 2
➜ kubebuilder git:(patch-1) ✗ |
Hi @PG2000
I do not have a M1, however, it should work well as well. it has no reason for it does not work at all. |
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.
Can you please squash the commits and rebase?
not approved yet. required to run make generate and squash commits as rebase with master
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.
Missing rebase, squash and run make generate
done. Fortunately the make generate works now. |
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86, PG2000 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 |
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.
Cool now you can check the lint erros.
We need to fix them in this PR to get it merged
You can run locally make lint as well to do the tests.
done |
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.
/lgtm
In order to have checks for some common errors in test files
this enables the built-in ginkgolinter.