
Build serious Go apps using Gin, Negroni, and more…
A platform for simple, reliable and concurrent services

- Developer deploys code
- Apps run in smart containers (dynos)
- Developer manages app in dashboard or CLI
- Data in web scale backing service via add-ons (database)
- User makes a request, which is served by the app
Get started now with Go on Heroku
Deploying Go apps with Heroku
- Initialize the local Git repository
go mod init
initializes the Go project- Create a
main.go
file to respond to requests with “Hello Heroku!” - Create and deploy the app to Heroku
- We’re live!
curl https://mighty-brook-91335-be676853b109.herokuapp.com
Heroku gives you simple, easy ways to…
Deploy
Deploy from Git, your CI system or to the API using precompiled builds. You can also deploy on every push to a branch in GitHub as part of your team’s workflow. Heroku runs your app in a dyno — a smart, secure, curated container with your choice of Go version. Run apps with popular frameworks and libraries — Gin, Martini, Negroni, Gorilla, Stdlib and more. Heroku gets out of the way and doesn’t require changes to deploy your app.
Manage
Manage your app portfolio in a straightforward Dashboard or with a CLI. Extend your apps with 200+ fully managed add-ons for a range of functionality such as data stores, logging and more. Provisioning an add-on is as simple as heroku addons:create papertrail
. You can just as easily add Heroku Postgres. Heroku contributes to key libraries such as pq
, ensuring great Postgres support.
Scale
Heroku’s horizontally scalable, share-nothing architecture is designed for building services in today’s world of containerized applications. App Metrics let you see CPU, throughput and memory so you know when to scale in real time. Scaling out your Go app’s web process is as simple as a single CLI command `heroku ps:scale web=2:Standard-1x` or dragging a slider in the Heroku Dashboard.
GO on Heroku
Popular Add-ons
Add-ons are fully-managed services, integrated for use with Heroku, which provide services for logging, caching, monitoring, persistence and more.
View All Add-ons
Heroku Postgres
Data Stores

Papertrail
Logging

New Relic APM
Monitoring

MongoLab
Data Stores

Redis Cloud
Data Stores
Heroku Go Support FAQ
How does Heroku manage Go dependencies?
Heroku manages Go dependencies using Go Modules, which is the standard for modern Go projects. When you deploy an application, Heroku’s buildpack detects your go.mod
file, which lists your project’s dependencies. During the build process, the buildpack automatically downloads these dependencies before compiling your code, ensuring a secure and repeatable build.
What is the fastest way to deploy a sample Go application to Heroku?
The fastest way to get started is by following the official Getting Started on Heroku with Go guide in the Heroku Dev Center. This tutorial provides a sample application and walks you through the steps of cloning the repository, provisioning a Heroku app, and deploying your code with a simple git push heroku main
command.
Which Go versions are supported on Heroku?
While many Go versions are available for use on Heroku, official support is generally provided for the latest minor release of the last two major Go versions.
You can specify your desired Go version in your go.mod
file. Heroku automatically detects this and resolves it to the latest available minor release within that major version. It is strongly recommended to always declare a version to ensure a consistent and predictable build environment.
What are the most popular Go frameworks to deploy on Heroku?
A unique aspect of the Go ecosystem is that many developers build powerful web applications using only the robust standard library, especially the net/http package, which Heroku fully supports.
For developers who prefer a framework, popular choices on Heroku include lightweight and high-performance options like Gin, Echo, and Chi. Whether you use a framework or stick to the standard library, Heroku can compile and run your Go web application.
Do I need to compile my Go application into a binary before deploying to Heroku?
No. For a standard deployment, you should push your Go source code directly to Heroku. The platform is designed to handle the entire build process for you. When an app is deployed, the Go buildpack reads your go.mod
file to download dependencies, installs the appropriate Go version, and compiles your code using the go install .
command. This source-based workflow ensures a clean and repeatable build and means you don’t need to commit compiled artifacts to your Git repository.
What is the go.mod file and how does Heroku use it?
The go.mod
file is the centerpiece of Go Modules, the standard way to manage dependencies in modern Go projects. It serves three main purposes: it declares the Go language version the module is compatible with, it defines the project’s module path, and it lists all the direct dependencies your project requires.
When you deploy to Heroku, the buildpack reads your go.mod
file to both select the correct Go version for the build and to understand which packages to download. This ensures a consistent build environment and that the exact dependencies your project needs are included in the final compiled binary.
If a go.sum
file is present, the Go toolchain also verifies that the installed modules match the expected cryptographic hashes.
Does Heroku support WebSockets for Go applications?
Yes. Heroku’s platform has native support for WebSockets, and Go’s powerful concurrency features make it an excellent language for building real-time applications.
While Go’s standard library does not include a WebSocket implementation, you can use popular libraries like Gorilla WebSocket. As with any WebSocket implementation on Heroku, you will need to send a heartbeat or ping message periodically to prevent the connection from being closed by an idle router. This makes Heroku a great choice for building real-time applications like live dashboards, streaming services, and chat applications with Go.
Ready to Get Started?
Stay focused on building great data-driven applications and let Heroku tackle the rest.