[object Object]

← back to Cli Printing Press

fix(cli): resolve validation binary path with platform.ExecutablePath (#1213)

7365fcc31c061342fd55c2c84633794a00e1d30a · 2026-05-12 09:10:20 -0700 · Trevin Chow

The generate-time validation gate built the binary path from
naming.ValidationBinary() directly, which is platform-agnostic. On
Windows, `go build -o <path>` appends `.exe`, but the subsequent
`<cli> --help`, `version`, and `doctor` gates exec'd the bare path
and failed with `executable file not found in %PATH%`.

Wrap the path in platform.ExecutablePath() — the same helper already
used by dogfood, shipcheck, runtime_exec, and publish — so the gate
runner targets the actual file go produced. naming.ValidationBinary
stays platform-agnostic, and artifacts.CleanupGeneratedCLI already
matches both `-validation` and `-validation.exe`, so no other
adjustments are required.

Refs #877, #1140 (P3 duplicates with the same root cause).

Fixes #978

Files touched

Diff

commit 7365fcc31c061342fd55c2c84633794a00e1d30a
Author: Trevin Chow <trevin@trevinchow.com>
Date:   Tue May 12 09:10:20 2026 -0700

    fix(cli): resolve validation binary path with platform.ExecutablePath (#1213)
    
    The generate-time validation gate built the binary path from
    naming.ValidationBinary() directly, which is platform-agnostic. On
    Windows, `go build -o <path>` appends `.exe`, but the subsequent
    `<cli> --help`, `version`, and `doctor` gates exec'd the bare path
    and failed with `executable file not found in %PATH%`.
    
    Wrap the path in platform.ExecutablePath() — the same helper already
    used by dogfood, shipcheck, runtime_exec, and publish — so the gate
    runner targets the actual file go produced. naming.ValidationBinary
    stays platform-agnostic, and artifacts.CleanupGeneratedCLI already
    matches both `-validation` and `-validation.exe`, so no other
    adjustments are required.
    
    Refs #877, #1140 (P3 duplicates with the same root cause).
    
    Fixes #978
---
 internal/generator/validate.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/internal/generator/validate.go b/internal/generator/validate.go
index 4908db7c..e3a54ec6 100644
--- a/internal/generator/validate.go
+++ b/internal/generator/validate.go
@@ -13,6 +13,7 @@ import (
 	"github.com/mvanhorn/cli-printing-press/v4/internal/artifacts"
 	"github.com/mvanhorn/cli-printing-press/v4/internal/govulncheck"
 	"github.com/mvanhorn/cli-printing-press/v4/internal/naming"
+	"github.com/mvanhorn/cli-printing-press/v4/internal/platform"
 )
 
 type validationGate struct {
@@ -23,7 +24,7 @@ type validationGate struct {
 const qualityGateTimeout = 5 * time.Minute
 
 func (g *Generator) Validate() error {
-	binPath := filepath.Join(g.OutputDir, naming.ValidationBinary(g.Spec.Name))
+	binPath := platform.ExecutablePath(filepath.Join(g.OutputDir, naming.ValidationBinary(g.Spec.Name)))
 	if err := artifacts.CleanupGeneratedCLI(g.OutputDir, artifacts.CleanupOptions{
 		RemoveValidationBinaries: true,
 		RemoveRecursiveCopies:    true,

← 460d676e fix(cli): index args[] by positional ordinal in path-param e  ·  back to Cli Printing Press  ·  docs(cli): cross-reference #1199 in mcp-handler positional-p 4aba68e6 →