Unverified Commit 2abb8cc7 authored by Jeremy Morrell's avatar Jeremy Morrell Committed by GitHub

Add new make rule for smaller go binaries (#660)

Running upx on go binaries reduces binary size ~ from 7MB -> 1.5MB
parent 84432143
...@@ -86,3 +86,8 @@ make test-heroku-16 ...@@ -86,3 +86,8 @@ make test-heroku-16
The tests are run via the vendored The tests are run via the vendored
[shunit2](https://github.com/kward/shunit2) [shunit2](https://github.com/kward/shunit2)
test framework. test framework.
## Updating go binaries
If you would like to develop and update the go binaries you will need to install
[go 1.12](https://golang.org/doc/install#install) and [upx](https://upx.github.io/)
...@@ -4,6 +4,14 @@ build: ...@@ -4,6 +4,14 @@ build:
@GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -v -o ./vendor/resolve-version-darwin ./cmd/resolve-version @GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -v -o ./vendor/resolve-version-darwin ./cmd/resolve-version
@GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -v -o ./vendor/resolve-version-linux ./cmd/resolve-version @GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -v -o ./vendor/resolve-version-linux ./cmd/resolve-version
build-production:
# build go binaries and then compress them
@GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -v -o ./vendor/resolve-version-darwin ./cmd/resolve-version
@GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -v -o ./vendor/resolve-version-linux ./cmd/resolve-version
# https://blog.filippo.io/shrink-your-go-binaries-with-this-one-weird-trick/
upx --brute vendor/resolve-version-linux
upx --brute vendor/resolve-version-darwin
test-binary: test-binary:
go test -v ./cmd/... -tags=integration go test -v ./cmd/... -tags=integration
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment