@@ -40,6 +40,9 @@ BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
4040
4141VERIFY_TLS ?= true
4242
43+ # GOWORK
44+ GOWORK ?= off
45+
4346# USE_IMAGE_DIGESTS defines if images are resolved via tags or digests
4447# You can enable this value if you would like to use SHA Based Digests
4548# To enable set flag to true
@@ -108,20 +111,21 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
108111
109112
110113.PHONY : generate
111- generate : controller-gen # # Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
114+ generate : gowork controller-gen # # Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
112115 $(CONTROLLER_GEN ) object:headerFile=" hack/boilerplate.go.txt" paths=" ./..."
113116
114117.PHONY : fmt
115118fmt : # # Run go fmt against code.
116119 go fmt ./...
117120
118121.PHONY : vet
119- vet : # # Run go vet against code.
122+ vet : gowork # # Run go vet against code.
120123 go vet ./...
124+ go vet ./... ./api/...
121125
122126.PHONY : test
123127test : manifests generate fmt vet envtest # # Run tests.
124- KUBEBUILDER_ASSETS=" $( shell $( ENVTEST) use $( ENVTEST_K8S_VERSION) -p path) " go test ./... -coverprofile cover.out
128+ KUBEBUILDER_ASSETS=" $( shell $( ENVTEST) use $( ENVTEST_K8S_VERSION) -p path) " go test ./... ./api/... -coverprofile cover.out
125129
126130# #@ Build
127131
@@ -272,20 +276,31 @@ get-ci-tools:
272276
273277# Run go fmt against code
274278gofmt : get-ci-tools
275- $(CI_TOOLS_REPO_DIR ) /test-runner/gofmt.sh
279+ GOWORK=$(GOWORK ) $(CI_TOOLS_REPO_DIR ) /test-runner/gofmt.sh
280+ GOWORK=$(GOWORK ) $(CI_TOOLS_REPO_DIR ) /test-runner/gofmt.sh ./api
276281
277282# Run go vet against code
278283govet : get-ci-tools
279- $(CI_TOOLS_REPO_DIR ) /test-runner/govet.sh
284+ GOWORK=$(GOWORK ) $(CI_TOOLS_REPO_DIR ) /test-runner/govet.sh
285+ GOWORK=$(GOWORK ) $(CI_TOOLS_REPO_DIR ) /test-runner/govet.sh ./api
280286
281287# Run go test against code
282288gotest : get-ci-tools
283- $(CI_TOOLS_REPO_DIR ) /test-runner/gotest.sh
289+ GOWORK=$(GOWORK ) $(CI_TOOLS_REPO_DIR ) /test-runner/gotest.sh
290+ GOWORK=$(GOWORK ) $(CI_TOOLS_REPO_DIR ) /test-runner/gotest.sh ./api
284291
285292# Run golangci-lint test against code
286293golangci : get-ci-tools
287- $(CI_TOOLS_REPO_DIR ) /test-runner/golangci.sh
294+ GOWORK=$(GOWORK ) $(CI_TOOLS_REPO_DIR ) /test-runner/golangci.sh
295+ GOWORK=$(GOWORK ) $(CI_TOOLS_REPO_DIR ) /test-runner/golangci.sh ./api
288296
289297# Run go lint against code
290298golint : get-ci-tools
291- PATH=$(GOBIN ) :$(PATH ) ; $(CI_TOOLS_REPO_DIR ) /test-runner/golint.sh
299+ GOWORK=$(GOWORK ) PATH=$(GOBIN ) :$(PATH ) ; $(CI_TOOLS_REPO_DIR ) /test-runner/golint.sh
300+ GOWORK=$(GOWORK ) PATH=$(GOBIN ) :$(PATH ) ; $(CI_TOOLS_REPO_DIR ) /test-runner/golint.sh ./api
301+
302+ .PHONY : gowork
303+ gowork : # # Generate go.work file to support our multi module repository
304+ test -f go.work || go work init
305+ go work use .
306+ go work use ./api
0 commit comments