Today, we're excited to introduce Go as the newest officially supported language on Heroku. Over the last 2 years we’ve fallen in love with Go, an expressive, concise, clean, and efficient language with built-in concurrency, making it easy to write and maintain network services, microservices and high-traffic API endpoints.
Now when writing Go you can leverage Heroku’s great developer experience and platform to quickly build apps your users can depend on. This includes the familiar
git push heroku master, review apps, metrics within your dashboard, and much more. As you'd expect, Heroku doesn't introduce any changes to your Go application runtime or dependencies. Your code is entirely yours and works seamlessly with many of the open tools in Heroku’s large ecosystem. Add-ons such as Postgres and Redis allow you to select services and tools without being locked into proprietary APIs. In addition to everything Heroku provides above, official Go support includes:
- Fast support and testing for new versions of the language, key frameworks/libraries & tools
- Notifications for critical vulnerabilities affecting your application
- Support for issues as well as availability of premium support
Read on for more or get started with Go on Heroku now.
We've seen the Go community buildpack grow for some time and during this time we’ve heavily embraced it ourselves, including building parts of our platform in Go:
Beyond using it ourselves we’ve engaged deeply with the community over the years. This includes contributing to the core of Go and key libraries such as pq, which ensures Go has a great package for supporting Postgres.
If you’re wondering why Go is our latest in officially supported languages, here’s a bit of background on the features that we find particularly attractive and compelling for adding Go to your developer toolbox.
Concurrency is where Go shines, providing two native building blocks: goroutines and channels. Goroutines provide lightweight, concurrent function execution, multiplexed across the configured number of CPUs. Each goroutine starts with a small stack, 2k bytes in size, that grows and shrinks as needed. They are as simple to use as go f(x), where f() is a function that will then run concurrently with whatever comes after. Channels are a typed conduit used to communicate values between goroutines. The go mantra is “Do not communicate by sharing memory; instead, share memory by communicating”. Channels are by default unbuffered, meaning synchronous and blocking. They can also be buffered, allowing values to queue up inside of them for processing. Multiple goroutines can read/write to the same channel at the same time w/o having to take locks.
Go has a standard code format and a tool to organize code into that format, putting an end to debates about tabs vs. spaces, punctuation placement, etc. The tool, go fmt, produces code that is uncontroversial as well as easier to read, write and maintain.
Go’s standard library is extremely comprehensive, providing a fairly complete, generally well thought out set of abstractions for everything from archive manipulation to cryptography, databases, image manipulation, network services (including HTTP clients and servers), testing and unicode support.
Go comes with tooling that enables profiling via HTTP, enabling you to determine where your application is spending time, allocating resources or blocking. The next release of Go (1.5) will also include high resolution execution tracing.
If you are new to the Go language, take a look at our Getting Started With Go On Heroku guide. Experienced Go developers will want to start with our Deploying Go Apps to Heroku guide. Signing up for a Heroku account to try Go is simple and you can get started for free.