support multi-arch for operator-sdk build
@@ -88,7 +88,13 @@ func buildFunc(cmd *cobra.Command, args []string) error {
}
projutil.MustInProjectRoot()
- goBuildEnv := append(os.Environ(), "GOOS=linux", "GOARCH=amd64")
+ goBuildEnv := append(os.Environ(), "GOOS=linux")
+
+ if value, ok := os.LookupEnv("GOARCH"); ok {
+ goBuildEnv = append(goBuildEnv, "GOARCH="+value)
+ } else {
+ goBuildEnv = append(goBuildEnv, "GOARCH=amd64")
+ }
// If CGO_ENABLED is not set, set it to '0'.
if _, ok := os.LookupEnv("CGO_ENABLED"); !ok {
