Skip to content

Commit ad82d47

Browse files
committed
auto-detect build runtime arch
If the user hasn't explictyly set GOARCH, don't default to amd64. This way, a user has to expliciltly cross-compile, instead of needing to know to set GOARCH on build for a native arch that isn't amd64. Signed-off-by: Christy Norman <christy@linux.vnet.ibm.com>
1 parent 7d39795 commit ad82d47

2 files changed

Lines changed: 1 addition & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
### Bug Fixes
1919
- Fix issue faced in the Ansible based operators when `jmespath` queries are used because it was not installed. ([#2252](https://github.com/operator-framework/operator-sdk/pull/2252))
20+
- Fix issue building on non-x86/AMD architectures where, if not explicitily overriden, users could end up with an AMD binary inside an image of a different architecture. ([#2268](https://github.com/operator-framework/operator-sdk/pull/2268))
2021

2122
## v0.12.0
2223

cmd/operator-sdk/build/cmd.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,6 @@ func buildFunc(cmd *cobra.Command, args []string) error {
9191
projutil.MustInProjectRoot()
9292
goBuildEnv := append(os.Environ(), "GOOS=linux")
9393

94-
if value, ok := os.LookupEnv("GOARCH"); ok {
95-
goBuildEnv = append(goBuildEnv, "GOARCH="+value)
96-
} else {
97-
goBuildEnv = append(goBuildEnv, "GOARCH=amd64")
98-
}
99-
10094
// If CGO_ENABLED is not set, set it to '0'.
10195
if _, ok := os.LookupEnv("CGO_ENABLED"); !ok {
10296
goBuildEnv = append(goBuildEnv, "CGO_ENABLED=0")

0 commit comments

Comments
 (0)