Skip to content

Commit d2e2b6a

Browse files
committed
make: date -uR produced a comma that was misinterpreted in go_$*_ldflags
Using set -x, I noticed that LDFLAGS= was being split on the commas: + LDFLAGS='-X version.Commit=6b3b365dbf4a3a907b6fd97d745efbd889afde0f -X version.BuildDate=Thu,' + 26 Sep 2024 14:34:51 '+0000 -X client.ClientID=k3TrDbfLhCgnpAbOiiT2kIE1AbovKzjo To fix this, I've decided to print the date without spaces or special chars. Before, it looked like this: Fri, 27 Sep 2024 10:15:10 +0000 Now, it looks like this: 2024-09-27-12:15:16-CEST
1 parent 89630f3 commit d2e2b6a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

make/00_mod.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ go_preflight_mod_dir := .
1313
go_preflight_ldflags := \
1414
-X $(repo_name)/pkg/version.PreflightVersion=$(VERSION) \
1515
-X $(repo_name)/pkg/version.Commit=$(GITCOMMIT) \
16-
-X $(repo_name)/pkg/version.BuildDate="$(shell date -uR)" \
16+
-X $(repo_name)/pkg/version.BuildDate="$$(date -uR)" \
1717
-X $(repo_name)/pkg/client.ClientID="k3TrDbfLhCgnpAbOiiT2kIE1AbovKzjo" \
1818
-X $(repo_name)/pkg/client.ClientSecret="f39w_3KT9Vp0VhzcPzvh-uVbudzqCFmHER3Huj0dvHgJwVrjxsoOQPIw_1SDiCfa" \
1919
-X $(repo_name)/pkg/client.AuthServerDomain="auth.jetstack.io"
@@ -43,4 +43,4 @@ $(YQ) \
4343
$1 --inplace
4444
endef
4545

46-
go_header_file := /dev/null
46+
go_header_file := /dev/null

make/test-unit.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.PHONY: test-unit
22
## Unit tests
33
## @category Testing
4-
test-unit: | $(NEEDS_GO) $(NEEDS_GOTESTSUM) $(ARTIFACTS)
4+
test-unit: | $(NEEDS_GO) $(NEEDS_GOTESTSUM) $(ARTIFACTS) $(NEEDS_ETCD) $(NEEDS_KUBE-APISERVER)
55
$(GOTESTSUM) \
66
--junitfile=$(ARTIFACTS)/junit-go-e2e.xml \
77
-- \
@@ -10,4 +10,5 @@ test-unit: | $(NEEDS_GO) $(NEEDS_GOTESTSUM) $(ARTIFACTS)
1010
-- \
1111
-ldflags $(go_preflight_ldflags)
1212

13+
export KUBEBUILDER_ASSETS=$(CURDIR)/$(bin_dir)/tools
1314
$(GO) tool cover -html=$(ARTIFACTS)/filtered.cov -o=$(ARTIFACTS)/filtered.html

0 commit comments

Comments
 (0)