GopherCon UK 2019

By 09/09/2019golang

GopherCon UK 2019

Hello Gopher’s, with these words GopherCon UK kicked off. The venue was packed with enthusiastic people interested in Go.  Dylan (UZ. Leuven) and myself (Brecht ~ JArchitects) are ready for 2 days of conferencing and networking. GopherCon UK is organised in the Brewery, a historical venue right in the middle of busy London. The contrast when first entering the venue can’t be bigger. A historical building set against a background of London’s all glass buildings.

 The day started with an introduction by the hosts Mark Bates and Mat Ryer. They introduced the speakers and made everybody excited about the talks by using some jokes and funny remarks.

 The conference schedule was filled with talks during the day. Next to that you also have workshops, where you can learn to contribute to Go, get an introduction to functional programming in Go or learn about testing techniques.  I focused on the talks and didn’t join any of these workshops but I bet these were quite interesting. Obviously it’s not possible to discuss all the talks that I attended but below are some of these talks. 

Finding dependable packages

In every conference you have to choose which track to follow… luckily for us the first talk at Gophercon was a keynote so we didn’t have to choose anything and could delay the choice of talks until later that day.

 The talk was presented by Julie Qiu, she discussed the importance of packages and making sure that your dependencies are good packages. Knowing how to choose a good package is extremely important since it can have a big impact on your project. Some things that should be taken into account are the popularity, code quality, documentation, testing and more. Julie presented a new platform that the golang tool team is working on, a platform to find the best modules/packages, taking into account the popularity, tests, quality and more. This way the (Go) tools team wants to give extra support to developers for finding packages and it will also motivate developers to improve the quality of the packages that they are maintaining.

REST services for the grpc curious

In my day to day work I use grpc and protocol buffers a lot, so most of the things discussed in this talk weren’t necessarily new, but sometimes it can’t hurt to go back to the basics. The talk  presented by Johan Brandhorst gave an excellent explanation on why we should all use protocol buffers and gRPC instead of JSON. Protocolbuffers are type safe, can be generated in different language and maybe the biggest thing is that it’s a lot more efficient to send over the wire.

In the current development landscape you are often required to use JSON. The gRPC-gateway presents a solution to this: it takes care of translating http/json to gRPC with some simple annotations in the proto description. A demo showed that for the developer this won’t give you any headache since the gateway will take care of translating to and from protocol buffers. This means that your api can be developed for gRPC and protocol buffers, while at the same time support json. As someone who works with these technologies daily, it was still interesting to get a detailed explanation and get a confirmation that we are on the right track with gRPC.

Impossible Go

The closing keynote for day one was given by Gautam Rege about some weird and confusing code fragments. This was a very interactive session where we as the audience tried to find the answer for some weird looking code. Although this code made your brain hurt you could win a t-shirt by correctly explaining what was happening. Next to all the coding challenges he talked about the way that he started his own company and that one of the most important factors when starting a company is that you have to be passionate. He couldn’t stress this enough, that passion is so important for the work that you do. As an end for the first day this talk was perfect. It was funny and fun to think about how the code fragments are working and it gave you a deeper understanding as to how you can use Go to solve certain problems.

Athens project

The second day started with a presentation about the Athens project. In Go you can use the simple command of go get to retrieve a package that is on GitHub, GitLab… But what happens when the maintainer suddenly decides to remove the repository or to remove a specific version that you are using. These actions can break you project. To solve this and other problems related to modules the Athens project was created. In short this is a proxy server that will keep a backup of all the modules that your project depends upon and the nice thing about Athens is that you are in complete control of your own Athens server, so you can deploy it wherever you want. As Aaron Schlesinger described, this also means that it can be used as a private artifact system for private modules and projects. Aaron explained how the module system came together and all the ideas behind the dependency system developed for Go. The Athens project is the next big step in providing a good solution for dependencies provided by Go.

Go analysis and generate

The second day continued with two back to back talks by the Go-Tools team.  The first one was about go analysis. In this talk Michael Matloob described the analysis package that every developer can use to create his own analysis checks. With these analysers a developer can improve his or his teams’ code by adding extra static checks. Although it takes some work to write an analyzer,it can save time to check your code on errors.The talk ended with a short explanation on how you can upload your own analyzers and checks to gopls. This language server protocol allows IDE’s to use even more analyzers to perform the static checks. Last but not least this package even enables you to suggest quick fixes. It’s a really cool package and it enables developers to easily contribute to gopls and help all the other developers in providing better quality code. 

The second talk by the go tools team was about code generation. Paul Jolly explained why we should use more code generation, as a developer you don’t want to do boring tasks like writing the same code over and over again. That’s why it makes sense to write some code generators in go. The go tool already supports a go generate command that enables you to generate code. Writing code generators can save a lot of time and reduce bugs. Giving the developer time to focus on the complex stuff. Paul showed in a demo( which was not really a demo, because live demos are too risky) that it’s easy and fast to write code generators. As somebody who is interested in code generation I think it’s quite interesting that Go provides the possibility to write code generators and that it doesn’t require obscure packages or complex code to write a code generator.

Fun with pointers

This talk was given by Daniela Petruzalek, it is one of the more technical talks that really dove into detail about something fundamental to Go. Daniela succeeded in giving a clear explanation on how pointers in Go work. The developers that come from the good old days of C/C++ know that you can do some crazy things with pointers. In Go pointers are a bit different and work a bit different. Go provides an extra layer on top of the bare pointers, with type safety and garbage collection. For the real lovers of pointers they can use the unsafe package, but as the name says it’s unsafe and circumvents a lot of checks of Go, whilst also breaking backwards-compatibility guarantees.

 Next to that Daniela explained that pointers should only be used in certain situations: for large structs that contain a lot of data, to prevent unnecessary copies, to get mutability of structs,… She also provides an example of when not to use pointers: for small structs it can be faster to use a struct as a value an not use pointers. Go is pass-by-value so even when you are using pointers in a function, the variable containing the address will be copied like any other value. So when entering a function you will have 2 references to that pointer. This means that pointers can be used as a pass-by-reference semantics but it’s still by using pass-by-value or in this case the address.
  The talk went into a lot more detail on how pointers are working under the hood It was really interesting because it gave the audience (and me) a better understanding of pointers in Go and how to properly use them.

Quick-fire round of talks

Some honorable mentions to interesting talks: One of the talks on the second day was about Web Assembly and how Go can be compiled to Web assembly. It was cool to see some hands on examples of Go code that can be built to run in the browser.
Another talk was about the energy consumption of golang code in the context of graph algorithms. It never occurred to me to think we should optimise our code with energy consumption in mind. But actually it makes sense in places where the battery is limited. The talk wasn’t the best to be honest but the idea behind it was interesting. Optimise your code for being energy efficient.
Lastly a talk about advanced testing techniques. Golang has a built in test system that is really easy to use. Alan Braithwaite showed multiple examples on how testing can be done right and how it helps other developers to understand what you’re code is trying to do. One of his biggest examples was the “Last HTTP test ever”, in this example you can make a generic testing function that can be used to test ever http server. 

GIO

The most impressive talk is without any doubt the talk by Elias Naur. He presented his project GIO, a library that can be used to create a UI with plain Go code. He gave a big live demo where he wrote all the code on the spot showing various functionalities. It was impressive to see how good this worked and how easy it is to write this code. Under the hood a lot of things are done for you, for example line wrapping or adding a scrollbar to a big list are all things you get for free without doing anything.

 This library is the perfect example of “write once, deploy everywhere”. Elias proved this by showing us that this Go program can be built for Android, IPhone, Web Assembly, Windows, MacOS & Linux without any effort. It was really impressive to see how easy everything was and it’s safe to say that he blew everybody’s mind with his library. 

This talk was the last for GopherCon UK 2019. The second day ended with a party. We got to see a live band and got as much burgers, fries, drinks as we could eat/drink. It provided the ideal opportunity for some networking before the weekend started and the conference was really done.

Tourist in London

When in London, one should at least visit a bit of the city. After two days of sitting inside we took Saturday to see a bit of London. The weather was amazing and we started our walk in the direction of the Tower Of London. Before getting there we visited the “Jack the Ripper Museum”. This museum showed how the victims lived and the gruesome way their life ended.  While walking next to the Tower of London, we found a hidden gem almost next to it: “All Hallows by the Tower”. This is one of the oldest churches in London and in the crypt of this church, a museum was made that showed relics from Ancient London. After a nice lunch we continued our walk over the Tower Bridge and ended it beneath The Shard. This was the end of our trip to London and Gophercon 2019, exhausted after these three days we took the Eurostar back home to Belgium.

Takeaway

The conference itself was well organised, everything was provided and present.  The talks were very interesting and I learned a lot over new features and discovered a lot of interesting use cases and projects where Go is being used for. Next to all the talks we got a lot of stuff and stickers of the Go gopher. The food was very good and all the snacks that we got made sure that you were never hungry. 

 It was fun to meet new people with the same interests in Go and learn how they are using Go in they’re day to day job. Overall I think that Go provides good solutions for modern problems and this conference showed that more and more people and companies are starting to see the benefits of using Go