diff --git a/Makefile b/Makefile index 34ae45d..9d2bf4c 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ test-e2e: .PHONY: build clean test run-node run-node2 run-node3 run-example deps tidy fmt vet lint clear-ports -VERSION := 0.52.5 +VERSION := 0.52.6 COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown) DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ) LDFLAGS := -X 'main.version=$(VERSION)' -X 'main.commit=$(COMMIT)' -X 'main.date=$(DATE)' diff --git a/pkg/cli/setup.go b/pkg/cli/setup.go index 8f20f8f..e72a793 100644 --- a/pkg/cli/setup.go +++ b/pkg/cli/setup.go @@ -380,21 +380,12 @@ func cloneAndBuild() { // Build fmt.Printf(" Building binaries...\n") - // Properly build environment with Go in PATH, avoiding duplicate PATH entries - var env []string - goPath := os.Getenv("PATH") + ":/usr/local/go/bin" - for _, e := range os.Environ() { - // Skip existing PATH entries to avoid duplicates - if !strings.HasPrefix(e, "PATH=") { - env = append(env, e) - } - } - // Add our modified PATH with Go - env = append(env, "PATH="+goPath) + // Ensure Go is in PATH for the build + os.Setenv("PATH", os.Getenv("PATH")+":/usr/local/go/bin") - cmd := exec.Command("sudo", "-u", "debros", "make", "build") + // Use sudo with --preserve-env=PATH to pass Go path to debros user + cmd := exec.Command("sudo", "--preserve-env=PATH", "-u", "debros", "make", "build") cmd.Dir = "/home/debros/src" - cmd.Env = env if output, err := cmd.CombinedOutput(); err != nil { fmt.Fprintf(os.Stderr, "❌ Failed to build: %v\n%s\n", err, output) os.Exit(1)