Go Buildpack on App Platform

App Platform is a Platform-as-a-Service (PaaS) offering that allows developers to publish code directly to DigitalOcean servers without worrying about the underlying infrastructure.

How App Platform Builds Images

App Platform supports two ways to build an image for your app: Cloud Native Buildpacks and Dockerfiles.

When you give App Platform access to your code, it defaults to using a Dockerfile if one is present in the root of the directory or specified in the app spec. Otherwise, App Platform checks your code to determine what language or framework it uses. If it supports the language or framework, it chooses an appropriate resource type and uses the proper buildpack to build the app and deploy a container.

Go Applications using Buildpacks

App Platform looks for any of the following files to detect a Go application:

  • go.mod
  • Gopkg.toml
  • Godeps/Godeps.json
  • vendor/vendor.json
  • glide.yaml

If App Platform detects one of these files, it guides you through the remaining configuration and then builds the app with the appropriate buildpack.

App Platform uses the heroku-buildpack-go buildpack for detecting and building Golang applications.

Current Buildpack Version and Supported Runtimes

App Platform uses version 184 of the Heroku Go Buildpack. The buildpack supports Go runtime versions 1.11 up to 1.21. If no version is specified in your app, App Platform defaults to using version 1.13.

The Go buildpack versions that are available are v1 and v0. It should be noted that Go v1 does not support Ubuntu-18. If you’d like to start using Go v1, we recommend upgrading your buildpack to Ubuntu-22 before upgrading to newer Go buildpack versions. To see specific runtimes that are available for these versions, please look at our release notes.

The buildpack supports the following Go runtime versions:

  • Ubuntu-22
    • 1.11 - 1.21
  • Ubuntu-18
    • 1.11 - 1.20

Specify a Go Version

App Platform automatically uses the Go version specified in your go.mod file:

module github.com/digitalocean/sample-golang

go 1.16