by remind101

GitHub Readme.md

Heroku Buildpack: Go

This is the Heroku buildpack for Go.

Getting Started

Follow the guide at

There's also a hello world sample app at


$ ls -A1

$ heroku create -b https://github.com/heroku/heroku-buildpack-go.git
Creating polar-waters-4785...

$ git push heroku master
-----> Fetching custom git buildpack... done
-----> Go app detected
-----> Installing go1.4.1... done
-----> Running: godep go install -tags heroku ./...
-----> Discovering process types
       Procfile declares types -> web

-----> Compressing... done, 1.6MB
-----> Launching... done, v4
       https://polar-waters-4785.herokuapp.com/ deployed to Heroku

This buildpack will detect your repository as Go if it contains a .go file.

This buildpack adds a heroku build constraint, to enable
heroku-specific code. See the App Engine build constraints
for more.

Hacking on this Buildpack

To change this buildpack, fork it on GitHub. Push changes to your fork, then
create a test app with --buildpack YOUR_GITHUB_GIT_URL and push to it. If you
already have an existing app you may use heroku config:add
instead of --buildpack.

Godeps vs .godir

This buildpack supports the use of godep, which will be used to
install the project and it's vendored dependencies if a Godeps/Godep.json
file exists. Otherwise this buildpack requires a file named .godir in the
root of your project to determine the name of the project and will use the
go toolchain to download dependencies.

Using with cgo

This buildpack supports building with C dependencies via
cgo. You can set config vars to specify CGO flags
to, e.g., specify paths for vendored dependencies. E.g., to build
gopgsqldriver, add the config var
CGO_CFLAGS with the value -I/app/code/vendor/include/postgresql and include
the relevant Postgres header files in vendor/include/postgresql/ in your app.

Passing a symbol (and optional string) to the linker

This buildpack supports the go linker's ability (-X symbol
) to set the value of a string at link time. This can be done by setting
GO_LINKER_SYMBOL and GO_LINKER_VALUE in the application's config before
pushing code. If GO_LINKER_SYMBOL is set, but GO_LINKER_VALUE isn't set

This can be used to embed the commit sha, or other build specific data directly
into the compiled executable.