diff --git a/magefile.go b/magefile.go index 3a11bd1b41b..8a189cb4521 100644 --- a/magefile.go +++ b/magefile.go @@ -37,7 +37,7 @@ import ( "github.com/elastic/elastic-agent/dev-tools/mage/otel" "github.com/jedib0t/go-pretty/v6/table" - "github.com/otiai10/copy" + filecopy "github.com/otiai10/copy" "github.com/elastic/elastic-agent/dev-tools/devmachine" "github.com/elastic/elastic-agent/dev-tools/mage" @@ -434,7 +434,11 @@ func (Build) TestBinaries() error { } outputName := filepath.Join(pkg, binary) - err := devtools.Run(nil, nil, os.Stderr, "go", pkg, "build", "-v", "-o", outputName, pkg) + finalArgs := make([]string, len(args)) + copy(finalArgs, args) + finalArgs = append(finalArgs, "-o", outputName, filepath.Join(pkg)) + + err := RunGo(finalArgs...) if err != nil { return err } @@ -1812,8 +1816,8 @@ func useDRAAgentBinaryForPackage(ctx context.Context, manifestURL string, versio log.Printf("copying %q to %q", srcBinaryPath, dstBinaryPath) - err = copy.Copy(srcBinaryPath, dstBinaryPath, copy.Options{ - PermissionControl: copy.PerservePermission, + err = filecopy.Copy(srcBinaryPath, dstBinaryPath, filecopy.Options{ + PermissionControl: filecopy.PerservePermission, }) if err != nil { return fmt.Errorf("copying %q to %q: %w", srcBinaryPath, dstBinaryPath, err)