Skip to content

Commit

Permalink
Merge pull request #484 from yue9944882/overridable-cgo-option
Browse files Browse the repository at this point in the history
Overridable CGO options for `build executables' commands
  • Loading branch information
k8s-ci-robot committed Mar 3, 2020
2 parents 9b2ebb1 + 10a86e8 commit 6e294ae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/apiserver-boot/boot/build/build_executables.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ func GoBuild(cmd *cobra.Command, args []string) {
// Build the controller manager
path := filepath.Join("cmd", "manager", "main.go")
c := exec.Command("go", "build", "-o", filepath.Join(outputdir, "controller-manager"), path)
c.Env = append(os.Environ(), "CGO_ENABLED=0")
if len(os.Getenv("CGO_ENABLED")) == 0 {
c.Env = append(os.Environ(), "CGO_ENABLED=0")
}
if len(goos) > 0 {
c.Env = append(c.Env, fmt.Sprintf("GOOS=%s", goos))
}
Expand Down

0 comments on commit 6e294ae

Please sign in to comment.