Add -s & -w flags to omit various symbol tables from the binary.

This does not effect backtraces.  Before the scope binary was 49M, now its 32M.

For more detauls, see https://blog.filippo.io/shrink-your-go-binaries-with-this-one-weird-trick/
This commit is contained in:
Tom Wilkie
2016-04-18 15:28:41 +01:00
parent 31a90c76c4
commit 8f03b67ade

View File

@@ -29,7 +29,7 @@ GO_HOST=$(NO_CROSS_COMP); $(GO)
WITH_GO_HOST_ENV=$(NO_CROSS_COMP); $(GO_ENV)
GO_BUILD_INSTALL_DEPS=-i
GO_BUILD_TAGS='netgo unsafe'
GO_BUILD_FLAGS=$(GO_BUILD_INSTALL_DEPS) -ldflags "-extldflags \"-static\" -X main.version=$(SCOPE_VERSION)" -tags $(GO_BUILD_TAGS)
GO_BUILD_FLAGS=$(GO_BUILD_INSTALL_DEPS) -ldflags "-extldflags \"-static\" -X main.version=$(SCOPE_VERSION) -s -w" -tags $(GO_BUILD_TAGS)
all: $(SCOPE_EXPORT)