From f97684d3866a4df548df17ffcd0cd9b5fc3716fc Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Thu, 16 Oct 2025 07:26:55 +0100 Subject: [PATCH 1/2] Use gomodule_name to handle go module/repo mismatch - Add gomodule_name and use it for ldflags and golangci-lint config - Update makefiles to reference gomodule_name instead of repo_name - Add TODO in go.mod to track renaming the Go module to match repo Signed-off-by: Richard Wall --- go.mod | 1 + make/00_mod.mk | 27 +++++++++++++++------------ make/ark/00_mod.mk | 6 +++--- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 16fe8b7d..36753be7 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,4 @@ +// TODO(wallrj): Rename the Go module to match the repository name module github.com/jetstack/preflight go 1.24.4 diff --git a/make/00_mod.mk b/make/00_mod.mk index 2e08f20a..df1a1353 100644 --- a/make/00_mod.mk +++ b/make/00_mod.mk @@ -1,10 +1,13 @@ repo_name := github.com/jetstack/jetstack-secure -# TODO(wallrj): This is a hack to allow use the old preflight repo name in the -# gci section of the golangci-lint config until we can rename the go module. -# Without this hack, golangci-lint will complain that the -# github.com/jetstack/preflight imports should be grouped with all the other -# third-party modules. -generate-golangci-lint-config: repo_name := github.com/jetstack/preflight +# This is a work around for the mismatch between the repo name and the go module +# name. It allows golangci-lint to group the github.com/jetstack/preflight +# imports correctly. And it allows the version information to be injected into +# the version package via Go ldflags. +# +# TODO(wallrj): Rename the Go module to match the repository name. +gomodule_name := github.com/jetstack/preflight + +generate-golangci-lint-config: repo_name := $(gomodule_name) license_ignore := gitlab.com/venafi,github.com/jetstack @@ -16,12 +19,12 @@ build_names := preflight go_preflight_main_dir := . go_preflight_mod_dir := . go_preflight_ldflags := \ - -X $(repo_name)/pkg/version.PreflightVersion=$(VERSION) \ - -X $(repo_name)/pkg/version.Commit=$(GITCOMMIT) \ - -X $(repo_name)/pkg/version.BuildDate=$(shell date "+%F-%T-%Z") \ - -X $(repo_name)/pkg/client.ClientID=k3TrDbfLhCgnpAbOiiT2kIE1AbovKzjo \ - -X $(repo_name)/pkg/client.ClientSecret=f39w_3KT9Vp0VhzcPzvh-uVbudzqCFmHER3Huj0dvHgJwVrjxsoOQPIw_1SDiCfa \ - -X $(repo_name)/pkg/client.AuthServerDomain=auth.jetstack.io + -X $(gomodule_name)/pkg/version.PreflightVersion=$(VERSION) \ + -X $(gomodule_name)/pkg/version.Commit=$(GITCOMMIT) \ + -X $(gomodule_name)/pkg/version.BuildDate=$(shell date "+%F-%T-%Z") \ + -X $(gomodule_name)/pkg/client.ClientID=k3TrDbfLhCgnpAbOiiT2kIE1AbovKzjo \ + -X $(gomodule_name)/pkg/client.ClientSecret=f39w_3KT9Vp0VhzcPzvh-uVbudzqCFmHER3Huj0dvHgJwVrjxsoOQPIw_1SDiCfa \ + -X $(gomodule_name)/pkg/client.AuthServerDomain=auth.jetstack.io oci_preflight_base_image_flavor := static oci_preflight_image_name := quay.io/jetstack/venafi-agent diff --git a/make/ark/00_mod.mk b/make/ark/00_mod.mk index 481e43d7..df450943 100644 --- a/make/ark/00_mod.mk +++ b/make/ark/00_mod.mk @@ -2,9 +2,9 @@ build_names += ark go_ark_main_dir := ./cmd/ark go_ark_mod_dir := . go_ark_ldflags := \ - -X $(repo_name)/pkg/version.PreflightVersion=$(VERSION) \ - -X $(repo_name)/pkg/version.Commit=$(GITCOMMIT) \ - -X $(repo_name)/pkg/version.BuildDate=$(shell date "+%F-%T-%Z") \ + -X $(gomodule_name)/pkg/version.PreflightVersion=$(VERSION) \ + -X $(gomodule_name)/pkg/version.Commit=$(GITCOMMIT) \ + -X $(gomodule_name)/pkg/version.BuildDate=$(shell date "+%F-%T-%Z") \ oci_ark_base_image_flavor := static oci_ark_image_name := quay.io/jetstack/disco-agent From 294fcba68f3bfd01b85446fa78ffea79f1064cad Mon Sep 17 00:00:00 2001 From: Mladen Rusev Date: Fri, 17 Oct 2025 12:11:08 +0300 Subject: [PATCH 2/2] remove trailing \ --- make/ark/00_mod.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/ark/00_mod.mk b/make/ark/00_mod.mk index df450943..8df9a152 100644 --- a/make/ark/00_mod.mk +++ b/make/ark/00_mod.mk @@ -4,7 +4,7 @@ go_ark_mod_dir := . go_ark_ldflags := \ -X $(gomodule_name)/pkg/version.PreflightVersion=$(VERSION) \ -X $(gomodule_name)/pkg/version.Commit=$(GITCOMMIT) \ - -X $(gomodule_name)/pkg/version.BuildDate=$(shell date "+%F-%T-%Z") \ + -X $(gomodule_name)/pkg/version.BuildDate=$(shell date "+%F-%T-%Z") oci_ark_base_image_flavor := static oci_ark_image_name := quay.io/jetstack/disco-agent