From 075ec12f8c4eee0bda0df5c93f436b274860f6d0 Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Fri, 8 Mar 2024 18:10:30 -0300 Subject: [PATCH] fix: Clean up around make lint command Signed-off-by: Mateus Oliveira --- .../testdata/project/Makefile | 16 ++++---------- .../testdata/project/Makefile | 16 ++++---------- .../testdata/project/api/v1/cronjob_types.go | 3 +-- .../project/api/v1/cronjob_webhook.go | 12 ++++++++--- .../project/api/v1/groupversion_info.go | 2 +- .../testdata/project/cmd/main.go | 2 -- .../internal/controller/cronjob_controller.go | 21 +++++++++++-------- .../getting-started/testdata/project/Makefile | 16 ++++---------- .../testdata/project/cmd/main.go | 4 ++-- .../scaffolds/internal/templates/makefile.go | 16 ++++---------- .../Makefile | 16 ++++---------- testdata/project-v4-multigroup/Makefile | 16 ++++---------- .../project-v4-with-deploy-image/Makefile | 16 ++++---------- testdata/project-v4-with-grafana/Makefile | 16 ++++---------- testdata/project-v4/Makefile | 16 ++++---------- 15 files changed, 61 insertions(+), 127 deletions(-) diff --git a/docs/book/src/component-config-tutorial/testdata/project/Makefile b/docs/book/src/component-config-tutorial/testdata/project/Makefile index c38d0294813..da4de7b0fcd 100644 --- a/docs/book/src/component-config-tutorial/testdata/project/Makefile +++ b/docs/book/src/component-config-tutorial/testdata/project/Makefile @@ -52,16 +52,8 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." -.PHONY: fmt -fmt: ## Run go fmt against code. - go fmt ./... - -.PHONY: vet -vet: ## Run go vet against code. - go vet ./... - .PHONY: test -test: manifests generate fmt vet envtest ## Run tests. +test: manifests generate envtest ## Run tests. KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out # Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors. @@ -70,7 +62,7 @@ test-e2e: go test ./test/e2e/ -v -ginkgo.v .PHONY: lint -lint: golangci-lint ## Run golangci-lint linter & yamllint +lint: golangci-lint ## Run golangci-lint linter $(GOLANGCI_LINT) run .PHONY: lint-fix @@ -80,11 +72,11 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes ##@ Build .PHONY: build -build: manifests generate fmt vet ## Build manager binary. +build: manifests generate ## Build manager binary. go build -o bin/manager cmd/main.go .PHONY: run -run: manifests generate fmt vet ## Run a controller from your host. +run: manifests generate ## Run a controller from your host. go run ./cmd/main.go # If you wish to build the manager image targeting other platforms you can use the --platform flag. diff --git a/docs/book/src/cronjob-tutorial/testdata/project/Makefile b/docs/book/src/cronjob-tutorial/testdata/project/Makefile index c38d0294813..da4de7b0fcd 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/Makefile +++ b/docs/book/src/cronjob-tutorial/testdata/project/Makefile @@ -52,16 +52,8 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." -.PHONY: fmt -fmt: ## Run go fmt against code. - go fmt ./... - -.PHONY: vet -vet: ## Run go vet against code. - go vet ./... - .PHONY: test -test: manifests generate fmt vet envtest ## Run tests. +test: manifests generate envtest ## Run tests. KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out # Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors. @@ -70,7 +62,7 @@ test-e2e: go test ./test/e2e/ -v -ginkgo.v .PHONY: lint -lint: golangci-lint ## Run golangci-lint linter & yamllint +lint: golangci-lint ## Run golangci-lint linter $(GOLANGCI_LINT) run .PHONY: lint-fix @@ -80,11 +72,11 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes ##@ Build .PHONY: build -build: manifests generate fmt vet ## Build manager binary. +build: manifests generate ## Build manager binary. go build -o bin/manager cmd/main.go .PHONY: run -run: manifests generate fmt vet ## Run a controller from your host. +run: manifests generate ## Run a controller from your host. go run ./cmd/main.go # If you wish to build the manager image targeting other platforms you can use the --platform flag. diff --git a/docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_types.go b/docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_types.go index 662051f80f7..3b43f6b450b 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_types.go +++ b/docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_types.go @@ -19,7 +19,6 @@ limitations under the License. */ package v1 - /* */ @@ -62,6 +61,7 @@ import ( the fields. */ + // CronJobSpec defines the desired state of CronJob type CronJobSpec struct { //+kubebuilder:validation:MinLength=0 @@ -188,5 +188,4 @@ type CronJobList struct { func init() { SchemeBuilder.Register(&CronJob{}, &CronJobList{}) } - //+kubebuilder:docs-gen:collapse=Root Object Definitions diff --git a/docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_webhook.go b/docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_webhook.go index c7a8ca05a18..a27067b3f94 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_webhook.go +++ b/docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_webhook.go @@ -37,7 +37,6 @@ Next, we'll setup a logger for the webhooks. */ var cronjoblog = logf.Log.WithName("cronjob-resource") - /* Then, we set up the webhook with the manager. */ @@ -65,11 +64,14 @@ A webhook will automatically be served that calls this defaulting. The `Default` method is expected to mutate the receiver, setting the defaults. */ + + + var _ webhook.Defaulter = &CronJob{} // Default implements webhook.Defaulter so a webhook will be registered for the type func (r *CronJob) Default() { - cronjoblog.Info("default", "name", r.Name) + cronjoblog.Info("default", "name", r.Name) if r.Spec.ConcurrencyPolicy == "" { r.Spec.ConcurrencyPolicy = AllowConcurrent @@ -115,12 +117,16 @@ Here, however, we just use the same shared validation for `ValidateCreate` and validate anything on deletion. */ + + + var _ webhook.Validator = &CronJob{} // ValidateCreate implements webhook.Validator so a webhook will be registered for the type func (r *CronJob) ValidateCreate() (admission.Warnings, error) { cronjoblog.Info("validate create", "name", r.Name) + return nil, r.validateCronJob() } @@ -128,6 +134,7 @@ func (r *CronJob) ValidateCreate() (admission.Warnings, error) { func (r *CronJob) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { cronjoblog.Info("validate update", "name", r.Name) + return nil, r.validateCronJob() } @@ -138,7 +145,6 @@ func (r *CronJob) ValidateDelete() (admission.Warnings, error) { // TODO(user): fill in your validation logic upon object deletion. return nil, nil } - /* We validate the name and the spec of the CronJob. */ diff --git a/docs/book/src/cronjob-tutorial/testdata/project/api/v1/groupversion_info.go b/docs/book/src/cronjob-tutorial/testdata/project/api/v1/groupversion_info.go index eb952f87a63..e7adbedff6f 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/api/v1/groupversion_info.go +++ b/docs/book/src/cronjob-tutorial/testdata/project/api/v1/groupversion_info.go @@ -23,6 +23,7 @@ former, while the latter is used by the CRD generator to generate the right metadata for the CRDs it creates from this package. */ + // Package v1 contains API Schema definitions for the batch v1 API group // +kubebuilder:object:generate=true // +groupName=batch.tutorial.kubebuilder.io @@ -32,7 +33,6 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "sigs.k8s.io/controller-runtime/pkg/scheme" ) - /* Then, we have the commonly useful variables that help us set up our Scheme. Since we need to use all the types in this package in our controller, it's diff --git a/docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go b/docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go index 14317caacd8..3121a0f9b99 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go +++ b/docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go @@ -39,7 +39,6 @@ import ( "tutorial.kubebuilder.io/project/internal/controller" //+kubebuilder:scaffold:imports ) - // +kubebuilder:docs-gen:collapse=Imports /* @@ -62,7 +61,6 @@ func init() { utilruntime.Must(batchv1.AddToScheme(scheme)) //+kubebuilder:scaffold:scheme } - /* The other thing that's changed is that kubebuilder has added a block calling our CronJob controller's `SetupWithManager` method. diff --git a/docs/book/src/cronjob-tutorial/testdata/project/internal/controller/cronjob_controller.go b/docs/book/src/cronjob-tutorial/testdata/project/internal/controller/cronjob_controller.go index 5b1adaa526e..4647565c528 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/internal/controller/cronjob_controller.go +++ b/docs/book/src/cronjob-tutorial/testdata/project/internal/controller/cronjob_controller.go @@ -45,13 +45,13 @@ import ( Next, we'll need a Clock, which will allow us to fake timing in our tests. */ + // CronJobReconciler reconciles a CronJob object type CronJobReconciler struct { client.Client Scheme *runtime.Scheme Clock } - /* We'll mock out the clock to make it easier to jump around in time while testing, the "real" clock just calls `time.Now`. @@ -74,6 +74,7 @@ managing jobs now, we'll need permissions for those, which means adding a couple more [markers](/reference/markers/rbac.md). */ + //+kubebuilder:rbac:groups=batch.tutorial.kubebuilder.io,resources=cronjobs,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=batch.tutorial.kubebuilder.io,resources=cronjobs/status,verbs=get;update;patch //+kubebuilder:rbac:groups=batch.tutorial.kubebuilder.io,resources=cronjobs/finalizers,verbs=update @@ -87,6 +88,7 @@ var ( scheduledTimeAnnotation = "batch.tutorial.kubebuilder.io/scheduled-at" ) + // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. // TODO(user): Modify the Reconcile function to compare the state specified by @@ -97,7 +99,7 @@ var ( // For more details, check Reconcile and its Result here: // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.17.0/pkg/reconcile func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - log := log.FromContext(ctx) +log := log.FromContext(ctx) /* ### 1: Load the CronJob by name @@ -461,15 +463,15 @@ func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct */ /* - We need to construct a job based on our CronJob's template. We'll copy over the spec - from the template and copy some basic object meta. + We need to construct a job based on our CronJob's template. We'll copy over the spec + from the template and copy some basic object meta. - Then, we'll set the "scheduled time" annotation so that we can reconstitute our - `LastScheduleTime` field each reconcile. + Then, we'll set the "scheduled time" annotation so that we can reconstitute our + `LastScheduleTime` field each reconcile. - Finally, we'll need to set an owner reference. This allows the Kubernetes garbage collector - to clean up jobs when we delete the CronJob, and allows controller-runtime to figure out - which cronjob needs to be reconciled when a given job changes (is added, deleted, completes, etc). + Finally, we'll need to set an owner reference. This allows the Kubernetes garbage collector + to clean up jobs when we delete the CronJob, and allows controller-runtime to figure out + which cronjob needs to be reconciled when a given job changes (is added, deleted, completes, etc). */ constructJobForCronJob := func(cronJob *batchv1.CronJob, scheduledTime time.Time) (*kbatch.Job, error) { // We want job names for a given nominal start time to have a deterministic name to avoid the same job being created twice @@ -546,6 +548,7 @@ var ( apiGVStr = batchv1.GroupVersion.String() ) + // SetupWithManager sets up the controller with the Manager. func (r *CronJobReconciler) SetupWithManager(mgr ctrl.Manager) error { // set up a real clock, since we're not in a test diff --git a/docs/book/src/getting-started/testdata/project/Makefile b/docs/book/src/getting-started/testdata/project/Makefile index c38d0294813..da4de7b0fcd 100644 --- a/docs/book/src/getting-started/testdata/project/Makefile +++ b/docs/book/src/getting-started/testdata/project/Makefile @@ -52,16 +52,8 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." -.PHONY: fmt -fmt: ## Run go fmt against code. - go fmt ./... - -.PHONY: vet -vet: ## Run go vet against code. - go vet ./... - .PHONY: test -test: manifests generate fmt vet envtest ## Run tests. +test: manifests generate envtest ## Run tests. KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out # Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors. @@ -70,7 +62,7 @@ test-e2e: go test ./test/e2e/ -v -ginkgo.v .PHONY: lint -lint: golangci-lint ## Run golangci-lint linter & yamllint +lint: golangci-lint ## Run golangci-lint linter $(GOLANGCI_LINT) run .PHONY: lint-fix @@ -80,11 +72,11 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes ##@ Build .PHONY: build -build: manifests generate fmt vet ## Build manager binary. +build: manifests generate ## Build manager binary. go build -o bin/manager cmd/main.go .PHONY: run -run: manifests generate fmt vet ## Run a controller from your host. +run: manifests generate ## Run a controller from your host. go run ./cmd/main.go # If you wish to build the manager image targeting other platforms you can use the --platform flag. diff --git a/docs/book/src/getting-started/testdata/project/cmd/main.go b/docs/book/src/getting-started/testdata/project/cmd/main.go index d829c4cba1a..adc2938e99f 100644 --- a/docs/book/src/getting-started/testdata/project/cmd/main.go +++ b/docs/book/src/getting-started/testdata/project/cmd/main.go @@ -80,8 +80,8 @@ func main() { } if err = (&controller.MemcachedReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), + Client: mgr.GetClient(), + Scheme: mgr.GetScheme(), Recorder: mgr.GetEventRecorderFor("memcached-controller"), }).SetupWithManager(mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "Memcached") diff --git a/pkg/plugins/golang/v4/scaffolds/internal/templates/makefile.go b/pkg/plugins/golang/v4/scaffolds/internal/templates/makefile.go index 870aae7f59a..d7d2549867c 100644 --- a/pkg/plugins/golang/v4/scaffolds/internal/templates/makefile.go +++ b/pkg/plugins/golang/v4/scaffolds/internal/templates/makefile.go @@ -126,16 +126,8 @@ generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and $(CONTROLLER_GEN) object paths="./..." {{- end }} -.PHONY: fmt -fmt: ## Run go fmt against code. - go fmt ./... - -.PHONY: vet -vet: ## Run go vet against code. - go vet ./... - .PHONY: test -test: manifests generate fmt vet envtest ## Run tests. +test: manifests generate envtest ## Run tests. KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out # Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors. @@ -144,7 +136,7 @@ test-e2e: go test ./test/e2e/ -v -ginkgo.v .PHONY: lint -lint: golangci-lint ## Run golangci-lint linter & yamllint +lint: golangci-lint ## Run golangci-lint linter $(GOLANGCI_LINT) run .PHONY: lint-fix @@ -154,11 +146,11 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes ##@ Build .PHONY: build -build: manifests generate fmt vet ## Build manager binary. +build: manifests generate ## Build manager binary. go build -o bin/manager cmd/main.go .PHONY: run -run: manifests generate fmt vet ## Run a controller from your host. +run: manifests generate ## Run a controller from your host. go run ./cmd/main.go # If you wish to build the manager image targeting other platforms you can use the --platform flag. diff --git a/testdata/project-v4-multigroup-with-deploy-image/Makefile b/testdata/project-v4-multigroup-with-deploy-image/Makefile index c38d0294813..da4de7b0fcd 100644 --- a/testdata/project-v4-multigroup-with-deploy-image/Makefile +++ b/testdata/project-v4-multigroup-with-deploy-image/Makefile @@ -52,16 +52,8 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." -.PHONY: fmt -fmt: ## Run go fmt against code. - go fmt ./... - -.PHONY: vet -vet: ## Run go vet against code. - go vet ./... - .PHONY: test -test: manifests generate fmt vet envtest ## Run tests. +test: manifests generate envtest ## Run tests. KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out # Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors. @@ -70,7 +62,7 @@ test-e2e: go test ./test/e2e/ -v -ginkgo.v .PHONY: lint -lint: golangci-lint ## Run golangci-lint linter & yamllint +lint: golangci-lint ## Run golangci-lint linter $(GOLANGCI_LINT) run .PHONY: lint-fix @@ -80,11 +72,11 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes ##@ Build .PHONY: build -build: manifests generate fmt vet ## Build manager binary. +build: manifests generate ## Build manager binary. go build -o bin/manager cmd/main.go .PHONY: run -run: manifests generate fmt vet ## Run a controller from your host. +run: manifests generate ## Run a controller from your host. go run ./cmd/main.go # If you wish to build the manager image targeting other platforms you can use the --platform flag. diff --git a/testdata/project-v4-multigroup/Makefile b/testdata/project-v4-multigroup/Makefile index c38d0294813..da4de7b0fcd 100644 --- a/testdata/project-v4-multigroup/Makefile +++ b/testdata/project-v4-multigroup/Makefile @@ -52,16 +52,8 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." -.PHONY: fmt -fmt: ## Run go fmt against code. - go fmt ./... - -.PHONY: vet -vet: ## Run go vet against code. - go vet ./... - .PHONY: test -test: manifests generate fmt vet envtest ## Run tests. +test: manifests generate envtest ## Run tests. KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out # Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors. @@ -70,7 +62,7 @@ test-e2e: go test ./test/e2e/ -v -ginkgo.v .PHONY: lint -lint: golangci-lint ## Run golangci-lint linter & yamllint +lint: golangci-lint ## Run golangci-lint linter $(GOLANGCI_LINT) run .PHONY: lint-fix @@ -80,11 +72,11 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes ##@ Build .PHONY: build -build: manifests generate fmt vet ## Build manager binary. +build: manifests generate ## Build manager binary. go build -o bin/manager cmd/main.go .PHONY: run -run: manifests generate fmt vet ## Run a controller from your host. +run: manifests generate ## Run a controller from your host. go run ./cmd/main.go # If you wish to build the manager image targeting other platforms you can use the --platform flag. diff --git a/testdata/project-v4-with-deploy-image/Makefile b/testdata/project-v4-with-deploy-image/Makefile index c38d0294813..da4de7b0fcd 100644 --- a/testdata/project-v4-with-deploy-image/Makefile +++ b/testdata/project-v4-with-deploy-image/Makefile @@ -52,16 +52,8 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." -.PHONY: fmt -fmt: ## Run go fmt against code. - go fmt ./... - -.PHONY: vet -vet: ## Run go vet against code. - go vet ./... - .PHONY: test -test: manifests generate fmt vet envtest ## Run tests. +test: manifests generate envtest ## Run tests. KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out # Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors. @@ -70,7 +62,7 @@ test-e2e: go test ./test/e2e/ -v -ginkgo.v .PHONY: lint -lint: golangci-lint ## Run golangci-lint linter & yamllint +lint: golangci-lint ## Run golangci-lint linter $(GOLANGCI_LINT) run .PHONY: lint-fix @@ -80,11 +72,11 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes ##@ Build .PHONY: build -build: manifests generate fmt vet ## Build manager binary. +build: manifests generate ## Build manager binary. go build -o bin/manager cmd/main.go .PHONY: run -run: manifests generate fmt vet ## Run a controller from your host. +run: manifests generate ## Run a controller from your host. go run ./cmd/main.go # If you wish to build the manager image targeting other platforms you can use the --platform flag. diff --git a/testdata/project-v4-with-grafana/Makefile b/testdata/project-v4-with-grafana/Makefile index c38d0294813..da4de7b0fcd 100644 --- a/testdata/project-v4-with-grafana/Makefile +++ b/testdata/project-v4-with-grafana/Makefile @@ -52,16 +52,8 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." -.PHONY: fmt -fmt: ## Run go fmt against code. - go fmt ./... - -.PHONY: vet -vet: ## Run go vet against code. - go vet ./... - .PHONY: test -test: manifests generate fmt vet envtest ## Run tests. +test: manifests generate envtest ## Run tests. KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out # Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors. @@ -70,7 +62,7 @@ test-e2e: go test ./test/e2e/ -v -ginkgo.v .PHONY: lint -lint: golangci-lint ## Run golangci-lint linter & yamllint +lint: golangci-lint ## Run golangci-lint linter $(GOLANGCI_LINT) run .PHONY: lint-fix @@ -80,11 +72,11 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes ##@ Build .PHONY: build -build: manifests generate fmt vet ## Build manager binary. +build: manifests generate ## Build manager binary. go build -o bin/manager cmd/main.go .PHONY: run -run: manifests generate fmt vet ## Run a controller from your host. +run: manifests generate ## Run a controller from your host. go run ./cmd/main.go # If you wish to build the manager image targeting other platforms you can use the --platform flag. diff --git a/testdata/project-v4/Makefile b/testdata/project-v4/Makefile index c38d0294813..da4de7b0fcd 100644 --- a/testdata/project-v4/Makefile +++ b/testdata/project-v4/Makefile @@ -52,16 +52,8 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." -.PHONY: fmt -fmt: ## Run go fmt against code. - go fmt ./... - -.PHONY: vet -vet: ## Run go vet against code. - go vet ./... - .PHONY: test -test: manifests generate fmt vet envtest ## Run tests. +test: manifests generate envtest ## Run tests. KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out # Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors. @@ -70,7 +62,7 @@ test-e2e: go test ./test/e2e/ -v -ginkgo.v .PHONY: lint -lint: golangci-lint ## Run golangci-lint linter & yamllint +lint: golangci-lint ## Run golangci-lint linter $(GOLANGCI_LINT) run .PHONY: lint-fix @@ -80,11 +72,11 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes ##@ Build .PHONY: build -build: manifests generate fmt vet ## Build manager binary. +build: manifests generate ## Build manager binary. go build -o bin/manager cmd/main.go .PHONY: run -run: manifests generate fmt vet ## Run a controller from your host. +run: manifests generate ## Run a controller from your host. go run ./cmd/main.go # If you wish to build the manager image targeting other platforms you can use the --platform flag.