Go at Gengo
At Gengo, the engineering team is constantly working to create a better experience for our customers and translators. One of the ways we’re doing this is by using more of our favorite new technologies such as Go, an open source programming language. We recently built several services in Go that have improved our speed, reliability and ease of use, including two projects we call GoShip and the Email Consumer.
GoShip, the first service that we wrote in Go, is an open source web application that makes it easy to deploy code to servers.
It takes a YAML configuration file containing hostnames, environments (pre-production, production, etc.) and the location of the git repository on remote servers. For each project, GoShip SSHes into its hosts and checks whether the latest git revision differs from the most recent revision on GitHub. If the revisions differ, a deploy button is shown on the page, which runs the deployment command specified for that project. The output is displayed and then stored along with the time and status of the deployment.
The Email Consumer
We also created a service to send emails that uses Iron.io‘s queue service, IronMQ. We call this the Email Consumer, which pulls JSON payloads off of a queue before rendering and sending the email that matches the ID in the payload.
"display_name": "Shawn Smith"
"from_name": "Consumer Test",
In the above example, a new customer signed up on our website, so our web application puts a JSON payload with the id “welcome-c” onto the queue. The Email Consumer consumes the payload and looks up the email subject for the email with the given ID, also rendering the template with the given data. In this case, the data is simply the user’s name. It also localizes the strings in the template based on the language code provided (in this case, it’s Japanese) and sends the email via SendGrid, welcoming the customer to Gengo.
Moving all of our emails into one place helps us easily make consistent style and copy edits. We send over 50 different emails to customers and translators through the Email Consumer, and to date it has sent over 500,000 emails without a problem.
On the backend
We’re moving several backend services from PHP and Python to Go as well. This includes loading and validating jobs in our translator workbench, as well as a port of our glossary service that reduced the total lines of code from 33,000 lines of Python and PHP to 1,700 lines of Go, improving the speed by a factor of 10. We don’t attribute the line count reduction entirely to Go—we removed a lot of legacy code, too—but Go made refactoring the service much simpler.
Our overall experience with Go in production has been very positive, and in the future we plan to move even more of our services to Go. If you’re interested in trying it out, take a look at how to get started and how to write Go code.