Skip to content

Commit

Permalink
overrideable CGO options
Browse files Browse the repository at this point in the history
  • Loading branch information
yue9944882 committed Feb 28, 2020
1 parent 9b2ebb1 commit 10a86e8
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 10a86e8

Please sign in to comment.