Resources for Developers

Go

The Go programming language is supported.

Deploying a Go application

Version compatibility

Officially supported

  • go1.10.3 (default)
  • go1.9.7

Other versions

Any version of Go can be used from go1.0.0, but it is advised to update your application to one of the officially supported versions.

Managing dependencies

When deploying a Go application it is important to ensure that the compilation is completely reproducible, multiple tools exist in the Go ecosystem, and Scalingo is compatible with the most used among them:

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 at 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 or dep

Yes, Godeps and dep are 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.10",
	"Packages": [
		"github.com/Scalingo/sample-go-martini"
	],
  ...
}

Buildpack

More information at https://github.com/Scalingo/go-buildpack.


mode_edit Suggest edits