Skip to content

Commit

Permalink
Always enable cgo in builds made with bazel
Browse files Browse the repository at this point in the history
This might make cross compiling a bit more difficult, but it is less
surprising when you know cgo will be enabled if it builds.

Background in buchgr#655.
  • Loading branch information
mostynb committed May 7, 2023
1 parent 983ed20 commit 4dd0d4f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ go_library(

go_binary(
name = "bazel-remote",
cgo = True,
embed = [":go_default_library"],
pure = "off",
static = "off",
Expand All @@ -55,6 +56,7 @@ go_binary(

go_binary(
name = "bazel-remote-linux-amd64",
cgo = True,
embed = [":go_default_library"],
goarch = "amd64",
goos = "linux",
Expand All @@ -66,32 +68,35 @@ go_binary(

go_binary(
name = "bazel-remote-linux-arm64",
cgo = True,
embed = [":go_default_library"],
goarch = "arm64",
goos = "linux",
pure = "on",
pure = "off",
static = "on",
visibility = ["//visibility:public"],
x_defs = {"main.gitCommit": "{STABLE_GIT_COMMIT}"},
)

go_binary(
name = "bazel-remote-darwin-amd64",
cgo = True,
embed = [":go_default_library"],
goarch = "amd64",
goos = "darwin",
pure = "on",
pure = "off",
static = "on",
visibility = ["//visibility:public"],
x_defs = {"main.gitCommit": "{STABLE_GIT_COMMIT}"},
)

go_binary(
name = "bazel-remote-darwin-arm64",
cgo = True,
embed = [":go_default_library"],
goarch = "arm64",
goos = "darwin",
pure = "on",
pure = "off",
static = "on",
visibility = ["//visibility:public"],
x_defs = {"main.gitCommit": "{STABLE_GIT_COMMIT}"},
Expand All @@ -103,6 +108,7 @@ BAZEL_REMOTE_USER_ID = 65532
go_image(
name = "bazel-remote-base",
base = "@cgo_amd64_base//image", # Does not include openssl.
cgo = True,
embed = [":go_default_library"],
goarch = "amd64",
goos = "linux",
Expand All @@ -115,6 +121,7 @@ go_image(
go_image(
name = "bazel-remote-base-arm64",
base = "@cgo_arm64_base//image", # Does not include openssl.
cgo = True,
embed = [":go_default_library"],
goarch = "arm64",
goos = "linux",
Expand Down

0 comments on commit 4dd0d4f

Please sign in to comment.