GopherCon was back in San Diego this year! As such, I was able to attend yet again. The conference was well worth attending and I had a great time. There were some great talks, a rather unusual workshop, and even some interesting sponsors/exhibitors. Here are some of my highlights!
Workshop: Intro to Rust
Why go to a Rust workshop at a Go programming conference? Good question. I believe it is valuable to explore other programming languages to gain experience with different approaches to software development. Rust is often compared to Go, albeit unfairly so. Go is heavily focused on microservices and ease of use for developers. Rust is more focused on memory safety, replacing C++, and blazing fast speeds. A developer can learn Go and deploy code to production in a week, but Rust has an infamously high learning curve. Along with this high learning curve comes a wealth of different features and the incredible claim of no memory leaks.
Memory leaks are eliminated through the unique concept of the borrow checker. Passing variables requires either copying them or “borrowing” them from the owner. Once a variable falls out of scope, it is gone; there is no need to allocate or delete any memory. As a result, memory leaks are caught at compile time and are near impossible in Rust. There are only a few minor exceptions to this rule.
For most use cases, I believe Go will be faster to develop in and is preferred for my projects. However, if I ever have a bottleneck where Go is simply not fast enough, Rust might be a good alternative to squeeze some extra performance.
Community Day: Gobot and TinyGo
As always, Ron Evans was at GopherCon to promote Gobot and TinyGo. Playing with code and electronics is always fun, so I made sure to drop by and check out their toys during the community day. As a fun surprise, they gave out a GoBadge to the people who came to hack. Turns out the GoBadge is a rebranded Adafruit PyBadge running TinyGo. By following the instructions in the GoBadge repo, you can flash the GoBadge software to the GoBadge and customize it with your name and such. They had several robots and drones to play with, as well as several bounties to earn through fixing bugs.
Russ Cox, the Go project lead at Google, gave the opening keynote and his primary focus was on upcoming changes to the Go toolchain to include usage telemetry. The telemetry will not include any information to identify individual users, only overall usage telemetry. The whole process is opt-in, but the Go team doesn’t actually need 100% participation. They expect there will be enough metrics to help determine the usefulness of certain features in Go from the people who volunteer to share. Probably the most impressive part is they plan on making all the telemetry public. Russ encouraged everyone to opt-in to the telemetry when it is released.
Powering a pinball machine with GoFlip
A Gopher passionate about pinball created a framework for powering a pinball table. Using this framework, he was able to refurbish and recreate an old, rare pinball game. His framework, GoFlip, is intended to be run on a Arduino using TinyGo. I’ve been lowkey obsessed with pinball recently, so this talk was absolutely fascinating to me.
Fun story: I went to the Google booth during the exhibitions. I started speaking to this older gentleman and he gave me a raffle ticket. I asked what he did at Google and he hesitated to respond. The younger girl next to him blurted out, “He created Go!” She pointed at his name on the agenda in the background. I was familiar with the name Robert Griesemer, but had never seen his picture. Really down to earth and nice guy.
He gave a closing keynote about how type inference works in Go and the challenges it poses. It was fascinating! He gave specific examples about how tricky it can be to determine the type of a variable, especially when generics are involved.
JSON v2 experimental package
An industrious gopher by the name of Joe Tsai recognized some of the shortcomings of the built-in encoding/json package and created an experimental package that seeks to address those shortcomings. The experimental package aims to be mostly backwards compatible, more flexible, and fix some performance issues. One big performance update is to make the encoder/decoder properly stream data, instead of loading into memory or reading the same data multiple times. There is a good chance this experiment ends up as an official Go proposal.
Profile Guided Optimization with
PGO was introduced in Go 1.20, but is now ready for production use in Go 1.21. The docs give a succinct description of what Profile Guided Optimization is:
Profile-guided optimization (PGO), also known as feedback-directed optimization (FDO), is a compiler optimization technique that feeds information (a profile) from representative runs of the application back into to the compiler for the next build of the application, which uses that information to make more informed optimization decisions. For example, the compiler may decide to more aggressively inline functions which the profile indicates are called frequently.
Currently, PGO is mostly doing inlining and devirtualization, but there are many future improvements in the works.
Structured logging with
The Go team decided to make their own structured logger and built upon the foundation of the
log package to make a new
slog package. They wanted it to be as fast as Uber’s Zap and easy enough to use. Structured logs are created by providing a series of key/value pairs.
slog also has logging levels and both JSON and plaintext formatters.
Static analysis using
govulncheck tool is an official static analysis tool for detecting security vulnerabilities in the code. It was released earlier this year and is worth running on pre-existing code to determine if there are any lingering vulnerabilities.
Compare benchmark differences with
Several presenters used
benchstat to make comparisons between benchmark results. I benchmark functions all the time, but somehow have never used
benchstat for comparing benchmark results, so I’m excited to add another tool to my arsenal.
Loser tree (tournament tree) for merging ordered sequences
There was a presentation about merging ordered sequences into a single sorted array and optimizing the algorithm using a “Loser tree”, also known as a “Tournament tree”. I had never heard of this algorithm before, so I was quite intrigued by the explanation of how it works. In short, you run comparisons across a binary tree and only store the “loser” of each comparison.
Using Go to migrate 80 billion database records
A software engineer at Bitly was tasked with migrating 80 billion database records from a relational database to Google Cloud Bigtable. She explained the various issues they ran into and how they were able to drastically reduce the migration time using concurrency in Go.
Feed the Gopher game
They provide a multi-region authentication solution. Descope runs in multiple AWS regions and handles failover transparently.
Relatively popular multi-region, scalable relational database. Supposedly CockroachDB supports a fully active-active multi-region setup and might be a good alternative to other commercial options, like AWS RDS PostgreSQL.
Open source alternative to Slack with paid additional features. If Slack ever goes the way of the dinosaur or gets exceedingly greedy, this might be a good replacement.
What is a group of Gophers called?
Someone mentioned in the conference that they decided a group of Gophers should be called a “concurrency”. Seems appropriate.
After the third and final day of the conference, there was a closing party downtown at Punchbowl Social. Our hosts provided an abundance of good food and I found a Godzilla Premium pinball machine nestled between some other arcade machines, so I was happy. Didn’t win any prizes from all the raffle tickets I collected, but that’s fine. The conference was great and I’m grateful I was able to attend. Hopefully I can make it back next year!