Skip to content

Commit

Permalink
Build go_binary targets with -s -w to reduce binary size
Browse files Browse the repository at this point in the history
  • Loading branch information
philwo committed Aug 7, 2020
1 parent b0621b4 commit ec60132
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ go_binary(
name = "bazelisk-darwin",
out = "bazelisk-darwin_amd64",
embed = [":go_default_library"],
gc_linkopts = [
"-s",
"-w",
],
goarch = "amd64",
goos = "darwin",
pure = "on",
Expand All @@ -93,6 +97,10 @@ go_binary(
name = "bazelisk-linux",
out = "bazelisk-linux_amd64",
embed = [":go_default_library"],
gc_linkopts = [
"-s",
"-w",
],
goarch = "amd64",
goos = "linux",
pure = "on",
Expand All @@ -103,6 +111,10 @@ go_binary(
name = "bazelisk-linux-arm64",
out = "bazelisk-linux_arm64",
embed = [":go_default_library"],
gc_linkopts = [
"-s",
"-w",
],
goarch = "arm64",
goos = "linux",
pure = "on",
Expand All @@ -113,6 +125,10 @@ go_binary(
name = "bazelisk-windows",
out = "bazelisk-windows_amd64.exe",
embed = [":go_default_library"],
gc_linkopts = [
"-s",
"-w",
],
goarch = "amd64",
goos = "windows",
pure = "on",
Expand Down

0 comments on commit ec60132

Please sign in to comment.