GopherCon UK 2018

August 1st – Workshops

Using and extending the Kubernetes API programmatically

Workshop tutors: Stefan Schimanski & Michael Hausenblas

Kubernetes is the de-facto standard for container orchestration. In this workshop you’ll learn how to program Kubernetes using Go. We will start with the basic concepts (pods, workloads, events, etc.) and provide step-by-step guidance on implementing a variety of tasks against the Kubernetes API.

This workshop was an interesting insight into working with the K8S API and extending it using Custom Resource Definitions. Using Katacoda for the training sessions made the learning experience straightforward and easy to follow.

August 2nd – Conference Day 1

A beautiful sunny day in London welcomed us to the first day of the conference proper. After getting everyone enrolled and refreshed, we headed upstairs to the main room for the Keynote:

Opening Keynote – You Might Be a Go Contributor Already and Not Know It

Speaker: Aditya Mukerjee

IMG_0053

Contributing to Go is more than just writing code for the compiler and standard library. Between other official Go projects, third-party projects, articles, workshops, and conference talks, you can even be a contributor to Go without ever even signing up for a Gerrit account.

Aditya’s presentation was an insightful view of how we all interact with the Go Community (In fact, “Community” formed a common thread throughout the conference). Blogging, tweeting and talking about Go all contribute to the community in meaningful ways. It’s not just about writing code!

Community Track – Blockchain Apps in Go

Speaker: Matthew Campbell

Ever wonder how blockchains work? Why is it that many popular blockchains are using Go? In this talk we will explore how blockchains work at a protocol level, what Go libraries you can use to interact with them. By the end of the talk you will be able to build your first Blockchain App.

This was a fascinating grounding in the technology, and the novel areas in which it can be applied. Developing Smart Contracts in Go is certainly something that warrants further exploration. However, Smart contract systems must be deterministic (no randomness) to prevent malicious use, so many of Go’s powerful concurrency features/paradigms such as goroutines, and floating point arithmetic cannot be utilised.

Glint Pay Track – Debuggers From Scratch

Speaker: Liz Rice

At some stage in your programming life you may well have used a debugger, but did you wonder how it was able to step into and control your executable? In this talk we’ll see how debuggers work by building one from scratch in a few lines of Go.

Used the syscall package with the ptrace functions https://golang.org/pkg/syscall/ to build a rudimentary debugger.

Code is here: https://github.com/lizrice/debugger-from-scratch

Mentioned that you should disallow ptrace calls in containers.

Glint Pay Track – Secrets about using Machine Learning and Go

Speaker: David Hernandez

After a year doing Machine Learning at Machine Box and with Go being my favorite language, I’d like to share my experiences. Covering best practices for training models and serving them in production, as well as little tips and tools that we use with Go to make your life a little bit easier.

Fascinating insight into what David learned working on machine learning using Go. The main take-away points were:

  1. Use Python, especially if you are new
  2. Wrap Python to use a model
  3. Use TensorFlow cgo library
  4. Don’t fear cgo to use C/C++
  5. Go libraries are a real option

Community Track – Broadcasting Channels: Writing a timeout-aware abstraction to enable asynchronous fanout in Go

Speaker: Sean Kelly

Channels – they sure are fun. You can do a lot with channels, but by default, only in a one-to-one manner. In this talk, I’ll show you how to enable one to many broadcast semantics in a thread-safe way, that can even gracefully handle shutdowns, failures, and panics.

General message was to be realistic when determining the base functionality required and implement that first without any bloat features. This allows you to produce the base solution to the experiment faster, which can then be built upon afterwards.

Despite the brief this was largely about how little you need to do this – and that it all depended on what problem you were trying to solve.

Started by talking about how pub sub comes with many issues; timeout, retrys, shuttings down, subscribers shutting down etc.

However depending on which of these you take into your problem space is how complicated your code has to be. At the heart of it, this can be done with a for loop and a list of channels.

Code is here: https://github.com/StabbyCutyou/spub

Community Track – Contributor Workshop

Love Go? Ever wanted to give something back? Come to the Go Contributor Workshop, where attendees will learn how to contribute to the Go project via Gerrit. To take part in the workshop, all you need is a laptop with Go and Git installed, and a basic understanding of Go. And, of course, an appetite for contributing to open source software!

During this workshop what became apparent was that it is actually much more straightforward than you might think to be able to contribute source code changes to the Go project.

The only slight gotcha was differences between the approval workflow and the normal github style workflow – changes must be submitted as a single commit, so that if you have to make changes you have to amend your commit (git change) and push that.

Red Hat OpenShift Track – Orchestration of microservices

Speaker: Bernd Rücker

Microservices, DDD, distributed systems, serverless. All trends decompose to the max, which moves the complexity to the collaboration of these pieces. I want to tell some war stories around that in this talk and give people some guidance.

Talked about BPMN and new service https://zeebe.io/ which handles the orchestration of microservices rather than scattering the flow logic throughout your microservices.

Red Hat OpenShift Track – Black Box Monitoring in Go

Speaker: Grant Griffiths

You’ve set up your favorite monitoring agent on all of your services and you have incredible visibility into the internals of your infrastructure. All seems good in the world, but can your end user actually use your service? In this talk we’ll write a simple app that simulates end user activity.

Grant spoke about using what he called “Probes” in your production environment which simulate user activity. This technique can spot issues that have not flagged up using traditional white box monitoring (Logs, hypervisor level stats ..) for a variety of reasons.

Red Hat OpenShift Track – Documenting Go Code with Beautiful Tests

Speaker: Paweł Słomka

Whether you believe in TDD or not, you must agree that it’s unwise to build production code with no tests. They verify your application, but also act as a perfect documentation for the development team. I would like to show a couple of tips and tricks of how you can write pretty and effective tests.

A high level look at the benefits of TDD and the go test tool and the work it can do for us i.e. race flag for checking for race conditions and the bench flag for simple benchmarking.

Glint Pay Track – Using Go for Healthcare

Speaker: Carmen Ruiz Vicente

DeepMind is a British artificial intelligence research company, dedicated to using that research to help address the toughest social challenges. In this talk, we’ll cover our working in healthcare, and how we use Go to power Streams, our mobile application used by NHS clinicians.

Google Deepmind’s first experience with the health care system, tasked with developing a mobile application for accessing patient data/history & quickly catching potential health issues based on patient data. All legacy (~95%) of legacy systems communicate via Health Level 7 (HL7) encoding standards; however, data is roughly acquired with pen & paper before being input into the system in some departments – as a result, data is not always formatted/typed as the HL7 standards specify (i.e. incorrect mixing of numerical and string data types). They generated Go structs from the HL7 documentation then used reflection to populate fields dynamically, making the HL7 parsing forgiving of format discrepancies.

Keynote – Code, Content, & Crafting Your Voice

Speaker: Amy Chen

Hi, my name is Amy! By day, I’m a systems software engineer and work in the fabulous world of distributed systems. However, outside of writing code, I also care a lot about making YouTube videos on my channel Amy Codes!

A talk on making an online brand to promote yourself.

August 3rd – Conference Day 2

IMG_0074

Phew! It was 32°C outside, which us brits are really not used to. Thankfully the venue (The Brewery) was air-conditioned throughout, so we could shelter from the heat and listen to another days excellent talks.

Keynote – Growing a Community of Gophers

Speaker: Cassandra Salisbury

IMG_0065

What it the true impact of community? In this talk we will go over what is important for community health, and what makes a healthy open source project. We will discuss how community has affected Gophers all over the world, and how individuals become leaders in their regions. Last, we will dig into how to get involved in the community in meaningful, tangible ways.

A passionate appeal to the go community as it matures into a fully fledged global development group, and the importance of being nice to one another in order to ensure it grows.

Red Hat OpenShift Track – From source code to Kubernetes, a Continuous Deployment tale.

Speaker: Alexandre González

This talk will cover the basics of creating good Docker images for your Go projects using multi-stage builds. Once we have that image ready we will need to run it somewhere, I think that a Kubernetes cluster could be a nice place to start. Of course, we don’t want to repeat those steps by hand everytime we want to do a new deployment so we will probably need to learn how to use a CI/CD tool to automate all the steps. And finally, the icing on the cake would be make this automagically run everytime we push code to our repository.

Alexandre González talks about how to improve delivery workflow by walking us through a simple Go application and deploying it via Kubernetes, docker and Jenkins to create a continuous deployment workflow. For me this highlighted was how easy it is to integrate such a workflow with existing CI tools like Travis. Since Kubernetes config relies on YAML files to define deployments, pods and services in a simple and declarative manner. Regardless of the application complexity, taking advantage of Kubernetes to easily deploy and run micro-services seems like the future.

Source code: https://github.com/agonzalezro/gophercon

Glint Pay Track – Experimental Refactoring with Go

Speaker: Jelmer Snoeck

Refactoring is essential to the software lifecycle. Can we make it safe enough to be a part of every company’s CD workflow? In this talk attendees will learn how to: utilise multi-step deploys; tame feature flags; run multiple code paths concurrently in production without influencing users.

Jelmer spoke about using feature switches, and refactoring and canary releases.

Glint Pay Track – Goroutines: the dark side of the runtime

Speaker: Roberto Clapis

Have you ever wondered what really lies behind the “go” statement? Did you ever stop and think about differences between goroutines and standard operative system threads? Is there something you should know to avoid bugs or weird, unintended behaviours?

This pointed some pitfalls of goroutines you might not expect; examples:

  • Closured variables evaluated when GoRoutine is run
  • No way to stop a GoRoutine when it’s running
  • If the garbage collector runs and you have a GoRoutine that won’t end then everything stops.

This talk was so popular that we couldn’t get in the room! Those of us who didn’t fit moved on to…

Community Track – Production Ready Go service in 30 minutes.

Speaker: Florin Pățan

We always hear how Go is a simple language, how it can enable developers to be productive. In this talk, we’ll start from scratch and develop a production-ready service in Go, using the standard library, a few popular libraries, instrument it, and deploy it using Docker.

This presentation showed how quick and easy it is to set up a service that covers everything you need in production.

Glint Pay Track – Understanding Go’s Memory Allocator

Speaker: André Carvalho

Ever wondered how does Go manage memory allocation? In this talk we are going to explore Go’s memory allocator and understand how its algorithm interacts with the operating system to manage memory!

This was a low level breakdown of Go’s memory allocator, with comparison to C’s memory allocator features (malloc/delete) and how both interact with system level (Unix) memory allocation APIs. The memory allocator is based on TCMalloc which was writting at Google for C. The Go allocator uses escape analysis to differentiate between heap or stack allocation to optimise the lifetime of allocated chucks. Go’s allocator differs from C’s in that it effectively chunks (by rounding up the amount of memory requested) allocation into 3 size buckets based on the size of memory requested. This improves the allocator’s ability to recycle memory once deallocated for use in future allocations.

Red Hat OpenShift Track – Building Resilient Data Pipelines in Go

Speaker: Grant Griffiths

The modern world runs on Data. In this talk we will cover how Gophers of any level can easily build Data Pipelines in Go with Kafka and Cassandra. At the end, we will look at how GE has written a Data Pipeline in Go that can handle over 800,000 writes per second of industrial time series data.

Grant Griffiths from GE Digital breaks uses a small shop example, Gophers R Us, to show how simple it is to construct reliable and scalable data pipelines in Go using Apache Kafka and Cassandra DB. Although the code samples were brief, the example used did show how easy the APIs in both Go libraries were to use and Grant even gave examples of how migrating from Java to Go meant that they could reduce their Cassandra Nodes and Kafka clusters by two thirds, not only massively reducing their hardware costs but due to the efficiency of the pipeline, almost double their throughput.

Glint Pay Track – Deep learning, ready? Go!

Speaker: Diana Carolina Ortega Muñoz

Imagine that you need to develop an Optical Character Recognition system using neural networks. Why is not Go your first choice for this kind of project? In this talk I’m going to show you a traditional solution using tensorflow and python, and also, how we can achieve a similar result using Go.

This presentation re-iterated the main points from David Hernandez talk from the previous day – that Python is the primary language for Machine Learning currently, but that this should not necessarily be a barrier to using Go.

Community Track – Go Test: Under the hood

Speaker: Sean Kelly

This talk will cover a brief introduction to go test, before diving into the more interesting parts of using the tool and the library itself. Covering topics like enabling testing of un-exported objects in separate testing packages, interesting or unconventional flags, and the newly added caching mechanisms, the talk will aim to raise folks understanding and capabilities with go test beyond just the basics, to help gophers become better testers by simply introducing them to more of the test tool and library itself.

There is a -json flag for go test tool which outputs test results in JSON format which can be used in later steps of a testing pipeline – not the most flexible format, but better than parsing original white space formatted output. Everyone is familiar with Test & Benchmark functions, but Example test functions are scarcely documented – can be used to embed code examples in godoc. Can also add “Output” comments to utilise Example functions which cause them to be included in by go test – this makes ensures that these godoc examples remain valid examples after future API changes. There are many more interesting flags which can be utilised in different combinations to provide different info – flags can be split into 2 categories – those that change how the binary is built, and those that change how the binary is run. General message to take from this is to never think you know everything about a tool – there will always be cheeky tricks you didn’t know existed!

How do you structure your Go apps?

Speaker: Kat Zień

“How should I structure my Go app?” is one of the most common questions asked by new and experienced developers alike. It certainly was one of my first questions, and is something I keep coming back to. Let’s discuss a few patterns and trends used in the industry these days.

Went over a couple of strategys for structuring a go application:

  • Flat: put everything in a root folder, to keep it simple consice and no circular dependencies. – good for small apps.
  • Function: n-Tier by business logic, storage, service folders. – can get complicated when lots of unrelated topics together.
  • Module: group by different concepts i.e. beer folder, review folder – can get complicated when the review is of a beer.
  • Context: DDD style group by functionality provided.
  • Hexagonal and Actor: Seemed to be more around architecture than how to keep code in order.

also mentioned to keep tests next to actual files they test.

Keynote – Athens – The Center of Knowledge

Speaker: Brian Ketelsen

IMG_0075

In the classical period of Greece, Athens was the center of knowledge, learning, and arts. The ideas that were born during that time are often considered as the birth of democracy and Western civilization. In this talk you’ll learn about the Athens project, bringing global package management to Go. You’ll learn about Zeus, the globally distributed system of proxy servers, and Olympus, the federated source of truth for package versions.

This excellent closing keynote announced Project Athens, which has 2 components: Package Registry and Edge Proxy.

Package Registry

The Athens registry is a Go package registry service that is hosted globally across multiple cloud providers. The global deployment will have a DNS name (i.e. registry.golang.org) that round-robins across each cloud deployment.

Edge Proxy

We intend proxies to be deployed primarily inside of enterprises to:

  • Host private modules
  • Exclude access to public modules
  • Cache public modules

Importantly, a proxy is not intended to be a complete mirror of an upstream registry. For public modules, its role is to cache and provide access control.