Skip to content

Commit d1eb470

Browse files
committed
Makefile: globally set GO_BUILD_TAGS
1 parent 835f6cc commit d1eb470

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@ help-extended: #HELP Display extended help.
102102

103103
.PHONY: lint
104104
lint: lint-custom $(GOLANGCI_LINT) #HELP Run golangci linter.
105-
$(GOLANGCI_LINT) run --build-tags $(GO_BUILD_TAGS) $(GOLANGCI_LINT_ARGS)
105+
$(GOLANGCI_LINT) run $(GOLANGCI_LINT_ARGS)
106106

107107
.PHONY: custom-linter-build
108108
custom-linter-build: #EXHELP Build custom linter
109-
go build -tags $(GO_BUILD_TAGS) -o ./bin/custom-linter ./hack/ci/custom-linters/cmd
109+
go build -o ./bin/custom-linter ./hack/ci/custom-linters/cmd
110110

111111
.PHONY: lint-custom
112112
lint-custom: custom-linter-build #EXHELP Call custom linter for the project
113-
go vet -tags=$(GO_BUILD_TAGS) -vettool=./bin/custom-linter ./...
113+
go vet -vettool=./bin/custom-linter ./...
114114

115115
.PHONY: tidy
116116
tidy: #HELP Update dependencies.
@@ -148,7 +148,7 @@ verify: tidy fmt generate manifests crd-ref-docs #HELP Verify all generated code
148148

149149
.PHONY: fix-lint
150150
fix-lint: $(GOLANGCI_LINT) #EXHELP Fix lint issues
151-
$(GOLANGCI_LINT) run --fix --build-tags $(GO_BUILD_TAGS) $(GOLANGCI_LINT_ARGS)
151+
$(GOLANGCI_LINT) run --fix $(GOLANGCI_LINT_ARGS)
152152

153153
.PHONY: fmt
154154
fmt: #EXHELP Formats code
@@ -208,7 +208,6 @@ test-unit: $(SETUP_ENVTEST) envtest-k8s-bins #HELP Run the unit tests
208208
rm -rf $(COVERAGE_UNIT_DIR) && mkdir -p $(COVERAGE_UNIT_DIR)
209209
KUBEBUILDER_ASSETS="$(shell $(SETUP_ENVTEST) use -p path $(ENVTEST_VERSION) $(SETUP_ENVTEST_BIN_DIR_OVERRIDE))" \
210210
CGO_ENABLED=1 go test \
211-
-tags '$(GO_BUILD_TAGS)' \
212211
-cover -coverprofile ${ROOT_DIR}/coverage/unit.out \
213212
-count=1 -race -short \
214213
$(UNIT_TEST_DIRS) \
@@ -219,8 +218,8 @@ E2E_REGISTRY_IMAGE=localhost/e2e-test-registry:devel
219218
image-registry: export GOOS=linux
220219
image-registry: export GOARCH=amd64
221220
image-registry: ## Build the testdata catalog used for e2e tests and push it to the image registry
222-
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
223-
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
221+
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
222+
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
224223
$(CONTAINER_RUNTIME) build -f ./testdata/Dockerfile -t $(E2E_REGISTRY_IMAGE) ./testdata
225224
$(CONTAINER_RUNTIME) save $(E2E_REGISTRY_IMAGE) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
226225
./testdata/build-test-registry.sh $(E2E_REGISTRY_NAMESPACE) $(E2E_REGISTRY_NAME) $(E2E_REGISTRY_IMAGE)
@@ -309,11 +308,12 @@ export GO_BUILD_FLAGS :=
309308
export GO_BUILD_LDFLAGS := -s -w \
310309
-X '$(VERSION_PATH).version=$(VERSION)' \
311310

311+
export GOFLAGS := "-tags=$(GO_BUILD_TAGS)"
312312
BINARIES=operator-controller catalogd
313313

314314
.PHONY: $(BINARIES)
315315
$(BINARIES):
316-
go build $(GO_BUILD_FLAGS) -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/$@ ./cmd/$@
316+
go build $(GO_BUILD_FLAGS) -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/$@ ./cmd/$@
317317

318318
.PHONY: build-deps
319319
build-deps: manifests generate fmt

0 commit comments

Comments
 (0)