Go

The Go programming language is supported.

Deploying a Go Application

Version Compatibility

Officially Supported

  • go1.23.3
  • go1.22.9
  • go1.21.13
  • go1.20.14 (default)

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.

Dependencies Installation

Scalingo installs the dependencies Go application using Go Modules.

Private Dependencies

Here is how to use a dependency in a private repository for your application.

The platform looks for environment variables that follow the following pattern: GO_GIT_CRED__<PROTOCOL>__<HOSTNAME>. Any periods (.) in the HOSTNAME must be replaces with double underscores (__).

The value of a matching var will be used as the username. If the value contains a “:”, the value will be split on the “:” and the left side will be used as the username and the right side used as the password. When no password is present, x-oauth-basic is used.

The following example will cause git to use the FakePersonalAccessTokenHere as the username when authenticating to github.com via https:

$ scalingo env-set GO_GIT_CRED__HTTPS__GITHUB__COM=FakePersoalAccessTokenHere

Defining a Procfile

web: <base package name>

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

web: example

Pre/Post Compile Hooks

If the file bin/go-pre-compile exists and is executable, it will be executed before compilation.

Likewise, if the file bin/go-post-compile exists and is executable, it will be executed after the compilation.

Because the buildpack installs compiled executables to bin, the go-post-compile hook can be written in Go if it’s installed by the specified <packagespec>.

Buildpack

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


Suggest edits

Go

©2024 Scalingo