Cloud Foundry buildpack for the Go Language
Clone or download
Pull request Compare This branch is 931 commits behind cloudfoundry:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
compile-extensions @ b5e0cf7

CloudFoundry build pack: Go(Lang)

A Cloud Foundry buildpack for Go(lang) based apps.

This is based on the [Heroku buildpack] (

Additional documentation can be found at



This buildpack will get used if you have any files with the .go extension in your repository.

cf push my_app -b

Disconnected environments

To use this buildpack on Cloud Foundry, where the Cloud Foundry instance limits some or all internet activity, please read the Disconnected Environments documentation.

Vendoring app dependencies

As stated in the Disconnected Environments documentation, your application must 'vendor' it's dependencies.

For the Go buildpack, use Godep:

cf push uploads your vendored dependencies. The buildpack will compile any dependencies requiring compilation while staging your application.


The buildpack only supports the two most stable patches for each dependency in the manifest.yml.

  1. Make sure you have fetched submodules
git submodule update --init
  1. Get latest buildpack dependencies
BUNDLE_GEMFILE=cf.Gemfile bundle
  1. Build the buildpack
BUNDLE_GEMFILE=cf.Gemfile bundle exec buildpack-packager [ --uncached | --cached ]
  1. Use in Cloud Foundry

    Upload the buildpack to your Cloud Foundry and optionally specify it by name

    cf create-buildpack custom_go_buildpack 1
    cf push my_app -b custom_go_buildpack

Deprecated Versions

If you would like to build the buildpack with previously supported dependency versions, provide the --use-custom-manifest=manifest-including-unsupported.yml option to buildpack-packager.


Find our guidelines here.

.godir and Godeps

Early versions of this buildpack required users to create a .godir file in the root of the project, containing the application name in order to build the project. While using a .godir file is still supported, it has been deprecated in favor of using godep in your project to manage dependencies, and including the generated Godep directory in your git repository.

This buildpack supports building with C dependencies via [cgo][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.

Reporting Issues

Open an issue on this project

Active Development

The project backlog is on Pivotal Tracker