Personal Insights
GopherCon UK 2019 – Conference Report
The Unconference
Finding dependable packages
- verifying that the package has a license that is appropriate.
- checking the popularity by means of the number of downloads, stars, forks, watchers, contributors, dependents. The latter is one of the best indicators that a package is usable.
- evaluating the code quality by navigating through the documentation. If it’s clear how to use the package and the code is understandable, the code quality might be okay. You should also ask yourself whether you want to pull the code of the package into your own codebase. This can also be evaluated with tooling such as goreportcard.
- verifying the upkeep of a package on the basis of maintainer activity, commit history, issue tracker, and the maintainers themselves.
- reviewing the transient dependencies that would be introduced when consuming the package.
As already announced in this blog, jqiu25 shared some mockups of a major revamp of godoc.org to make the discoverability of available modules easier. The tracking issue for the progress on this tool can be found here.
Robotics with Go is a Breeze
This talk by @Skarlso was supposed to be about how to control drones in Go. Actually, it was the funniest talk of the conference with a high level of entertainment factor: numerous drones were knocked out of the air, go routines said goodbye with panics and there was a speaker who managed to stay cool as ice and saved the situation well.
Unfortunately, the drone constantly lost its connection and could no longer be controlled as a result. Nevertheless, @Skarlso was able to mediate what one can achieve with a few lines of code. Since the drone had a camera integrated there was even a small demo of the face detection and classification functionality. Although it didn’t work reliably it was still a good demonstration.
The drone being used is available for less than $100 and the frameworks used (i.e., gobot) are open source. I’m definitely curious to try it out as soon as I get to it.
Go as a Scripting Language in Linux
This talk by @secumod was especially interesting to me, as I have faced the exact same issues in the past. Without contacting the StackOverflow community and trying it by my own, I spent half an hour to get my Go script working but at the end I gave up and switched back to ruby, which is (at least for me) a bit more convenient for scripting. One of the problems you run into is already the first line of a script: the shebangline. Go does not support shebang.
@secumod guided through all the possible mistakes that can be made and even analyzed the linux kernel to alleviate the problems. As he pointed out, one possible workaround is gorun, a package which wraps the built-in go run
command. However, gorun has the caveat that the go files cannot be compiled with go build
anymore.
The final approach sets up a binary format description for *.go
files by using the Linux Kernel function binfmt_misc
. With this configuration of the OS the standard go run
can be used. More details about how the speaker runs .go
scripts can be found on the original blog post.
Impossible Go
The first conference day finished with an inspiring keynote from @gautamrege who is co-founder of Jos Software. He presented a collection of code snippets that produced more or less surprising results after execution. The talk itself was very interactive and for correct answers there was a chance to win a t-shirt. In addition to the coding examples, the speaker also gave some advice and wisdom which helped him founding his company. He shared some of the pitfalls that can bite you when starting your own business and emphasized that there is one disposition that matters the most: passion.
This was the very last talk of the first conference day, which was then closed with a social event at the bowling hall.
Improving Dependencies for Everyone
The second conference started with a keynote about the Athens project by @arschles. In short, Athens is a proxy server and Go module datastore for all the dependency packages in a Go project. Everyone can host an own public or private mirror, which allows organizations to manage their public and private code in the same way. In addition, Athens approaches the problem of not having immutable code in the dependencies of a Go project. Since commits and tags can be changed in code version control systems (VCS), you might see checksum verification errors in your project from time to time. The Athens database stores an immutable copy of the dependencies after invoking go get
. This works by Athens first looking into the local memory and only if a module was not found fetching the module from the VCS. Athens never changes anything once it saves a module to storage. This means that even if the remote version or tag changes, the module remains stable in the database and thus also in the project.
All in all, Athens seems to be a good extension for the built-in dependency system of Go. There is good documentation available with lots of examples. The #athens
channel in the gophers slack is very active and you get immediate help with your questions.
Tackling Contention
One of the few sessions that were classified as advanced at the GopherCon schedule was the talk about contention from @empijei. Since BOSH, the project our team is working on, is a highly distributed system, we also had to look at concurrency issues every once in a while, which is why I was particularly interested in this presentation.
To have a common understanding of the terminology, the speaker defined contention as the competition between different processes to acquire a lock. Contention might be caused when writing parallel concurrent code. It turned out that there are different sorts of contention, e.g. cache contention, mutexes. In a brief summary, the following steps should be considered if you want to reduce contention:
- Measure by using Go’s profiling tools pprof and
-trace
. - Understand your underlying data structures
- Fix your code if necessary with
sharding: decentralize the state if jobs take the same time and if queue is stable
batching: contend less by reducing the number of accesses to shared state (if latency is not critical and consistency is ensured)
padding: add additional bytes to fields in your struct. This can prevent false sharing - Measure again.
Gio
The event has been finished with a stunning live coding demo held by @elias_naur who demonstrated gio, a portable framework to build GUI programs on all the major platforms. This demo was by far the most impressive I’ve ever seen because Elias not only did an incredibly comprehensive live coding session, but also because everything worked right away and after the talk the audience had a good understanding of what can be done with the framework. They thanked with a loud applause at the end of the demo.
Gio is 100% Go and only depends on lowest-level platform libraries. Another nice thing is the portability which allows developers to write the code once and run it (almost) everywhere – iOS/tvOS, Android, Linux (Wayland), macOS, Windows and browsers (Webassembly/WebGL). The speaker demonstrated this by running his demo code on both his macbook and the iOS simulator.