Skip to content

Commit 65a6cd9

Browse files
mergify[bot]pchila
andauthored
Restore workaround for golang/go#67854 (#11258) (#11305)
(cherry picked from commit fd86b05) Co-authored-by: Paolo Chilà <paolo.chila@elastic.co>
1 parent f62a76a commit 65a6cd9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

magefile.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import (
3737
"github.com/elastic/elastic-agent/dev-tools/mage/otel"
3838

3939
"github.com/jedib0t/go-pretty/v6/table"
40-
"github.com/otiai10/copy"
40+
filecopy "github.com/otiai10/copy"
4141

4242
"github.com/elastic/elastic-agent/dev-tools/devmachine"
4343
"github.com/elastic/elastic-agent/dev-tools/mage"
@@ -434,7 +434,11 @@ func (Build) TestBinaries() error {
434434
}
435435

436436
outputName := filepath.Join(pkg, binary)
437-
err := devtools.Run(nil, nil, os.Stderr, "go", pkg, "build", "-v", "-o", outputName, pkg)
437+
finalArgs := make([]string, len(args))
438+
copy(finalArgs, args)
439+
finalArgs = append(finalArgs, "-o", outputName, filepath.Join(pkg))
440+
441+
err := RunGo(finalArgs...)
438442
if err != nil {
439443
return err
440444
}
@@ -1812,8 +1816,8 @@ func useDRAAgentBinaryForPackage(ctx context.Context, manifestURL string, versio
18121816

18131817
log.Printf("copying %q to %q", srcBinaryPath, dstBinaryPath)
18141818

1815-
err = copy.Copy(srcBinaryPath, dstBinaryPath, copy.Options{
1816-
PermissionControl: copy.PerservePermission,
1819+
err = filecopy.Copy(srcBinaryPath, dstBinaryPath, filecopy.Options{
1820+
PermissionControl: filecopy.PerservePermission,
18171821
})
18181822
if err != nil {
18191823
return fmt.Errorf("copying %q to %q: %w", srcBinaryPath, dstBinaryPath, err)

0 commit comments

Comments
 (0)