Using Go in Government

Original author: Kushal Pisavadia
  • Transfer
When the UK Government Digital Service took over GOV.UK, the code was mostly written in Ruby . Since then, we have tried several languages, including Java, Clojure, Scala, Python, and Javascript. Recently, we have switched to Go for a number of projects.
Below is a short report on the experience gained. How we used Go and what in our opinion it is useful to know for other developers thinking about introducing the language in their environment. If you are interested in the details, then we published more detailed information on the blog - router ( my translation ), crawler and CDN acceptance test .

Why go at all?


We collectively recognize that learning and experimenting with new technologies introduces us to new approaches and broadens our vision. New generation programming languages ​​offer new methods for solving problems.
We heard a lot of flattering about Go. Successful experience in using the language in the Google infrastructure and understanding of the level of the team behind it gave a lot of optimism, but multithreading, speed of execution and low resource requirements became the decisive factors for the experiment . Other languages ​​used by us simply could not offer us this.

Easy to understand


The language is defined by a fairly simple and clear specification. This makes it easier to arouse initial interest among colleagues for parsing the code, and then participating in the development. However, we have never felt limited by this simplicity. When you need expressiveness to build your own models, abstraction of the interface and compositionality provide a sufficient and reliable arsenal of tools.
In fact, the much-praised standard language library turned out to be. It covers a wide range of everyday tasks including, for example, access to the file system, building HTTP services, console utilities, working with JSON data and calendar views. The standard library has sufficient depth and well-designed architecture. As far as possible the library is built on RFC standards, as a fundamental material.
The library is written in high-quality, idiomatic code and well-documented so that it can serve as a training tool even for experienced developers. In addition, a young fighter course and a standard code formatting utility are offered .

Easy to deploy


Over the past few years, we have studied various Ruby deployment models (such as Unicorn workers) and built our tools . We cultivate regular and frequent releases . Deployment-facilitating technologies are extremely popular in our circumstances and here Go has proven its worth.
The language does not have special system requirements to support the runtime. The program is statically compiled into one binary, which is installed on the machine where it will be executed. There are no runtime dependencies (like bundle install for Ruby) needed on the target machine. And restarting the service is an order of magnitude faster and easier than in Ruby.

Ease of use


Usually the team decides which language is right. This is a team decision, not a personal one. Over the past year, Go has won wide acclaim from our team. Let's try to explain why.
It is easy for them to infect people, from the system administrator who pretended to be unable to program, to the developer who tried Go as a second language. The success of the language is greatly facilitated by the caring attitude of its trustees. In particular, backward compatibility guarantees for 1.x releases are very important to us .
Utilities go tool greatly simplifies life when solving typical tasks of the project development cycle. The C-shaped syntax makes it easy to get to know the language before mastering specific idioms.
If your motto is “Make it work. Make it right. Make it fast ”(“Get it to work. It worked correctly. And it worked quickly”), then you can be sure that written on Go works fast enough on the first try. The execution speed is high and is growing steadily with each release, and the standard library is well equipped. This means that we can concentrate on the characteristics of our code that are important for the team: understandability and readability.

What's next


To us at GDS, to completely switch to Go, the rest is to deal with a couple of questions. One of them is dependency versioning. For key nodes of the system, we must fix the version of the code and the version of its dependencies, and provide a reproducible assembly. Language Trustees have publicly endorsed vending . We are attracted to using gom and godep as possible solutions that are more developer friendly.
We can safely say that we intend to increase our array of code in the Go language.

[approx. per.] Of the third-party Go libraries, GDS actively uses gor to mirror traffic and vegeta for stress testing, which is written on the blog.

Also popular now: