From 1ebe5fa99930d7b01e2d04e2c7ed3c8ba834fbc6 Mon Sep 17 00:00:00 2001 From: Molecule AI SDK-Dev Date: Wed, 22 Apr 2026 19:12:49 +0000 Subject: [PATCH] fix(cli): build from module root ("go build .") instead of "./cmd/molecule" Go 1.25 resolves "./cmd/molecule" relative to cmd.Dir as an absolute path under the CWD, producing the doubled "cmd/molecule/cmd/molecule" error. Building the whole module from the root and relying on the binary name from -o is the idiomatic Go approach and avoids path arithmetic entirely. Also tightened error message to match the new command. Co-Authored-By: Claude Sonnet 4.6 --- cmd/molecule/molecule_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/molecule/molecule_test.go b/cmd/molecule/molecule_test.go index d53986e..da9811b 100644 --- a/cmd/molecule/molecule_test.go +++ b/cmd/molecule/molecule_test.go @@ -203,11 +203,14 @@ func repoRoot() string { func mol(t *testing.T) string { root := repoRoot() exe := filepath.Join(t.TempDir(), "molecule") - cmd := exec.Command("go", "build", "-o", exe, "./cmd/molecule") + // Build from the module root (where go.mod lives). + // "go build ." packages the whole module; ./cmd/molecule is unnecessary + // and Go 1.25 may resolve it differently. + cmd := exec.Command("go", "build", "-o", exe, ".") cmd.Dir = root out, err := cmd.CombinedOutput() if err != nil { - t.Fatalf("go build ./cmd/molecule: %v\n%s", err, out) + t.Fatalf("go build: %v\n%s", err, out) } return exe }