From ec601329a3c0ccdecb3040a0b40ed3e7695ee8d0 Mon Sep 17 00:00:00 2001 From: Philipp Wollermann Date: Fri, 7 Aug 2020 15:59:00 +0200 Subject: [PATCH] Build go_binary targets with -s -w to reduce binary size --- BUILD | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/BUILD b/BUILD index ec84cb71..7cbba3cb 100644 --- a/BUILD +++ b/BUILD @@ -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", @@ -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", @@ -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", @@ -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",