Skip to content

Commit 23c02ad

Browse files
committed
Makefile: globally set GO_BUILD_TAGS
1 parent 6eb8218 commit 23c02ad

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Diff for: Makefile

+9-8
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ help-extended: #HELP Display extended help.
100100

101101
.PHONY: lint
102102
lint: lint-custom $(GOLANGCI_LINT) #HELP Run golangci linter.
103-
$(GOLANGCI_LINT) run --build-tags $(GO_BUILD_TAGS) $(GOLANGCI_LINT_ARGS)
103+
$(GOLANGCI_LINT) run $(GOLANGCI_LINT_ARGS)
104104

105105
.PHONY: custom-linter-build
106106
custom-linter-build: #HELP Build custom linter
107-
go build -tags $(GO_BUILD_TAGS) -o ./bin/custom-linter ./hack/ci/custom-linters/cmd
107+
go build -o ./bin/custom-linter ./hack/ci/custom-linters/cmd
108108

109109
.PHONY: lint-custom
110110
lint-custom: custom-linter-build #HELP Call custom linter for the project
111-
go vet -tags=$(GO_BUILD_TAGS) -vettool=./bin/custom-linter ./...
111+
go vet -vettool=./bin/custom-linter ./...
112112

113113
.PHONY: tidy
114114
tidy: #HELP Update dependencies.
@@ -138,7 +138,7 @@ verify: tidy fmt generate manifests crd-ref-docs #HELP Verify all generated code
138138

139139
.PHONY: fix-lint
140140
fix-lint: $(GOLANGCI_LINT) #EXHELP Fix lint issues
141-
$(GOLANGCI_LINT) run --fix --build-tags $(GO_BUILD_TAGS) $(GOLANGCI_LINT_ARGS)
141+
$(GOLANGCI_LINT) run --fix $(GOLANGCI_LINT_ARGS)
142142

143143
.PHONY: fmt
144144
fmt: #EXHELP Formats code
@@ -197,7 +197,6 @@ test-unit: $(SETUP_ENVTEST) envtest-k8s-bins #HELP Run the unit tests
197197
rm -rf $(COVERAGE_UNIT_DIR) && mkdir -p $(COVERAGE_UNIT_DIR)
198198
KUBEBUILDER_ASSETS="$(shell $(SETUP_ENVTEST) use -p path $(ENVTEST_VERSION) $(SETUP_ENVTEST_BIN_DIR_OVERRIDE))" \
199199
CGO_ENABLED=1 go test \
200-
-tags '$(GO_BUILD_TAGS)' \
201200
-cover -coverprofile ${ROOT_DIR}/coverage/unit.out \
202201
-count=1 -race -short \
203202
$(UNIT_TEST_DIRS) \
@@ -208,8 +207,8 @@ E2E_REGISTRY_IMAGE=localhost/e2e-test-registry:devel
208207
image-registry: export GOOS=linux
209208
image-registry: export GOARCH=amd64
210209
image-registry: ## Build the testdata catalog used for e2e tests and push it to the image registry
211-
go build $(GO_BUILD_FLAGS) -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o ./testdata/registry/bin/registry ./testdata/registry/registry.go
212-
go build $(GO_BUILD_FLAGS) -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o ./testdata/push/bin/push ./testdata/push/push.go
210+
go build $(GO_BUILD_FLAGS) -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o ./testdata/registry/bin/registry ./testdata/registry/registry.go
211+
go build $(GO_BUILD_FLAGS) -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o ./testdata/push/bin/push ./testdata/push/push.go
213212
$(CONTAINER_RUNTIME) build -f ./testdata/Dockerfile -t $(E2E_REGISTRY_IMAGE) ./testdata
214213
$(CONTAINER_RUNTIME) save $(E2E_REGISTRY_IMAGE) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
215214
./testdata/build-test-registry.sh $(E2E_REGISTRY_NAMESPACE) $(E2E_REGISTRY_NAME) $(E2E_REGISTRY_IMAGE)
@@ -317,10 +316,12 @@ export GO_BUILD_FLAGS :=
317316
export GO_BUILD_LDFLAGS := -s -w \
318317
-X '$(VERSION_PATH).version=$(VERSION)' \
319318

319+
export GOFLAGS := "-tags=$(GO_BUILD_TAGS)"
320+
320321
BINARIES=operator-controller
321322

322323
$(BINARIES):
323-
go build $(GO_BUILD_FLAGS) -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/$@ ./cmd/$@
324+
go build $(GO_BUILD_FLAGS) -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/$@ ./cmd/$@
324325

325326
.PHONY: build-deps
326327
build-deps: manifests generate fmt

0 commit comments

Comments
 (0)