Go

The Go programming language is supported.

Deploying a Go application

Using Godeps

When deploying a go application it is important to ensure that the compilation is completely reproducible. Godeps ensures this by vendoring all the third-party dependencies of your project in the Godeps/_workspace directory of your project.

Setting up Godeps

go get github.com/tools/godep
godep save <package of your project>
git add Godeps
git commit -m "Vendor all dependencies with Godeps"

For more details about the management of these vendored dependencies, refer to the Godeps documentation.

Defining a Procfile

web: <base package name>

Example if your package is github.com/user/example:

web: example

You can find an example at: https://github.com/Scalingo/sample-go-martini

Using .godir (Deprecated)

The alternative is to use a .godir file a the root of your project defining the name of your project binary. All the dependencies will be downloaded using go get and in this case the repeatability of the operation is not ensured.

.godir:

my-sample

Procfile:

web: my-sample

Example: https://github.com/Scalingo/sample-go-martini/tree/godir

Common questions

My application is only using the standard library, do I need Godeps

Yes, Godeps is not only about freezing dependencies version, it is also to save the go runtime you’re using. We’ll install the same version as the one specified in Godeps/Godeps.json, at the key .GoVersion

Example:

{
	"ImportPath": "github.com/Scalingo/sample-go-maritni",
	"GoVersion": "go1.6",
	"Packages": [
		"github.com/Scalingo/sample-go-martini"
	],
  ...
}

Buildpack

Link to Go Buildpack

schedule 18 Feb 2016