Skip to content

Instantly share code, notes, and snippets.

@ae6rt
Created November 27, 2014 23:47
Show Gist options
  • Save ae6rt/32537e2f3a9d4102bfae to your computer and use it in GitHub Desktop.
Save ae6rt/32537e2f3a9d4102bfae to your computer and use it in GitHub Desktop.
Setting subpackage vars with ldflags during a Go build
VERSION := 1.0
DATE := $(shell date)
COMMIT_ID := $(shell git rev-parse --short HEAD)
SDK_INFO := $(shell go version)
BUILD_DIR=build
LD_FLAGS := -X github.com/xoom/gorest/rest.version $(VERSION) -X github.com/xoom/gorest/rest.commit $(COMMIT_ID) -X github.com/xoom/gorest/rest.buildTime '$(DATE)' -X github.com/xoom/gorest/rest.sdkInfo '$(SDK_INFO)'
@ae6rt
Copy link
Author

ae6rt commented Nov 27, 2014

The "main" package resides in .../xoom/gorest. The rest package is a subpackage of this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment