From 4a99ec2c1fb1676cae1a660add2e1771ff16bc60 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 3 Nov 2026 19:50:14 +0100 Subject: [PATCH] Pass Go's build info into mergeBuildInfo This makes it possible to test mergeBuildInfo with build info that we construct in the test. Co-Authored-By: Claude Opus 5.5 --- pkg/app/entry_point.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/app/entry_point.go b/pkg/app/entry_point.go index d69e7f4ab..9b11eac97 100644 --- a/pkg/app/entry_point.go +++ b/pkg/app/entry_point.go @@ -52,7 +52,8 @@ type BuildInfo struct { func Start(buildInfo *BuildInfo, integrationTest integrationTypes.IntegrationTest) { cliArgs := parseCliArgsAndEnvVars() - mergeBuildInfo(buildInfo) + goBuildInfo, _ := debug.ReadBuildInfo() + mergeBuildInfo(buildInfo, goBuildInfo) if cliArgs.RepoPath != "" { if cliArgs.WorkTree != "" || cliArgs.GitDir != "" { @@ -277,7 +278,7 @@ func parseGitArg(gitArg string) appTypes.GitArg { // into the binary by default e.g. the git commit hash. So in this function // we merge the two together, giving priority to the stuff set by LDFLAGS. // Note: this mutates the argument passed in -func mergeBuildInfo(buildInfo *BuildInfo) { +func mergeBuildInfo(buildInfo *BuildInfo, goBuildInfo *debug.BuildInfo) { // if the version has already been set by build flags then we'll honour that. // chances are it's something like v0.31.0 which is more informative than a // commit hash. @@ -287,8 +288,7 @@ func mergeBuildInfo(buildInfo *BuildInfo) { buildInfo.Version = "unversioned" - goBuildInfo, ok := debug.ReadBuildInfo() - if !ok { + if goBuildInfo == nil { return }