Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
moukoublen committed Aug 1, 2024
1 parent 9edf2b1 commit 48ca1ca
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions dev-tools/mage/crossbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,13 @@ func (b GolangCrossBuilder) Build() error {
// This fixes an issue where during arm64 linux build for the currently used docker image
// docker.elastic.co/beats-dev/golang-crossbuild:1.22.5-arm the image for amd64 arch is pulled
// and causes problems when using native arch tools on the binaries that are built for arm64 arch.
if strings.HasPrefix(b.Platform, "linux/") && !b.UseHostPlatform {
args = append(args,
"--platform", b.Platform,
)
} else if strings.HasPrefix(b.Platform, "linux/") && b.UseHostPlatform {
args = append(args,
"--platform", dockerHostPlatform(),
)
// Unless the flag UseHostPlatform is set, in which case the host platform is used for container runtime.
if strings.HasPrefix(b.Platform, "linux/") {
platform := b.Platform
if b.UseHostPlatform {
platform = dockerHostPlatform()
}
args = append(args, "--platform", platform)
}

args = append(args,
Expand Down

0 comments on commit 48ca1ca

Please sign in to comment.