Skip to content

Commit

Permalink
export to function
Browse files Browse the repository at this point in the history
  • Loading branch information
moukoublen committed Jul 24, 2024
1 parent e21b94e commit f5b8780
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion dev-tools/mage/crossbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ func (b GolangCrossBuilder) Build() error {
)
} else if strings.HasPrefix(b.Platform, "linux/") && b.UseHostPlatform {
args = append(args,
"--platform", "linux/"+runtime.GOARCH,
"--platform", dockerHostPlatform(),
)
}

Expand All @@ -371,6 +371,16 @@ func (b GolangCrossBuilder) Build() error {
return dockerRun(args...)
}

func dockerHostPlatform() string {
os := runtime.GOOS
// darwin docker runs inside a linux vm
if os == "darwin" {
os = "linux"
}

return os + "/" + runtime.GOARCH
}

// DockerChown chowns files generated during build. EXEC_UID and EXEC_GID must
// be set in the containers environment otherwise this is a noop.
func DockerChown(path string) {
Expand Down

0 comments on commit f5b8780

Please sign in to comment.