Shut Up And Take My Telemetry Data! • The Applied Go Weekly Newsletter 2024-08-04
Your weekly source of Go news, tips, and projects
You know that a new Go release is coming when the number of release-specific articles spikes. This issue contains another article, another podcast, and a Go Tip about Go 1.23. Among all the new and improved features, there is one that is perhaps the most controversial: telemetry.
It was possible to enable telemetry before, but now it becomes a part of the standard toolchain and even gets a subcommand: go telemetry
.
I know there have been numerous discussions about this feature. The original proposal suggested that telemetry should be enabled by default, but after heated discussions in the Go community, telemetry is now strictly opt-in.
I respect everyone's decision regarding opting in or not, but for myself, I have decided to enable telemetry.
Why? Because (a) it helps improve Go, and (b) it is fully transparent. Go to Go Telemetry to see all collected telemetry data. It's really anonymous. Russ Cox explained the telemetry project and its design for transparency in great detail.
Maybe you decide to help improve the Go toolchain? If so, you can do so in Go 1.23 by running a simple command: go telemetry on
.
Featured Articles
Passing torches to Austin and Cherry
Breaking news! After 12+ years, Russ Cox will step from the Go tech lead role on Sept. 1st. The new tech lead will be Austin Clements, and Cherry Mui will take over Austin's current role as tech lead for the Go core (compiler toolchain, runtime, and releases).
The Developer’s Guide to Database Proxies: When to Use Them and How to Create One
What's a database proxy good for? it can route queries to the correct database, validate queries, add (meta-) information to responses, enforce security policies, and more. But gray, my dear friend, is every theory, And green alone life's golden tree (1). So Alex Pliutau concludes this article with a sample implementation of a database proxy that can rewrite table names if they match a given pattern.
(1) Said Mephisto in Goethe's "Faust". I wonder how a golden tree can be green at the same time...!?
Build Your Own SMTP Server in Go
Getting an SMTP server up and running is 50% writing code and 50% stuggling with setting up DKIM, SPF, and DMARC. Alexis Bouchez covers both sides in this article.
How I made Inkmi in Go Self Healing
Imagine you run a SaaS solo-business. You go offline for a day to go hiking, biking, rafting, mountain climbing, or whatwever form of recreation you choose. When you come back in the evening, you realize that your SaaS is down for hours. What a nightmare!
The only way to avoid this seems to consist in building a distributed microservice architecture with a Kubernetes cluster and a fancy failover strategy. With all the baggage that comes along with running a Kubernetes cluster.
But wait! Good ol' systemd
is enough to make your app self-healing. Health-checks, soft restarts without losing client connections, and zero-downtime upgrades are possible with a little systemd
configuration and a Go app that restarts fast. Stephan Schmidt, CTO coach and Gopher by conviction, uses some simple techniques to keep his monolith running, and sleeps better since then. (Or so I guess.)
Podcast corner
Go Time: What's new in Go 1.23
Carlana and John inspect the new and changed features of Go 1.23.
Cup o' Go: 🎮 BDFL but drop the FL, Game Development, and more!
BDFL - Benevolent Dictator For Life? Guess who they are talking about! I'm not sure if I'd support the "dictator" attribute, but "benevolent" for sure.
Go tip of the week: Removal of response headers for errors can break on-the-fly encoding in Go 1.23
The Go 1.23 pre-relase notes describe a change that might affect Web server code. Among the changes to net/http
, a particular change can cause code to not function anymore. Here is the excerpt:
ServeContent, ServeFile, and ServeFileFS now remove the Cache-Control, Content-Encoding, Etag, and Last-Modified headers when serving an error. These headers usually apply to the non-error content, but not to the text of errors.
Middleware which wraps a ResponseWriter and applies on-the-fly encoding, such as Content-Encoding: gzip, will not function after this change. The previous behavior of ServeContent, ServeFile, and ServeFileFS may be restored by setting GODEBUG=httpservecontentkeepheaders=1.
Note that middleware which changes the size of the served content (such as by compressing it) already does not function properly when ServeContent handles a Range request. On-the-fly compression should use the Transfer-Encoding header instead of Content-Encoding.
TL;DR: Several HTTP headers will not be included in an error response anymore. Middleware that does on-the-fly encoding and thus would need to set the Content-Encoding header, will break due to this change.
Quote: Fail of the day
Started rolling my Go programming again. Needed to look up the date handling. Searching for "go date" was probably the search fail of the day.
More articles, videos, talks
Escape JavaScript hell and write everything in Go
This article would have been a great match for the previous issue's title: "My Web App Stack? Go."
Microbus.io | Microservices Framework
Microbus aims to be more than a simple and fast messaging bus, including features that you would have to add on top of other messaging systems. The developers announced general availability this week, here is the link to the home page (lacking a release article, but you may refer to the announcement on /r/golang
).
Golang Defer: A Detailed Guide
"Deferred functions run whenever the enclosing function exist." Yeah but... there is way more to know about Go's defer statements. Phuong Le inspects the inner mechanics of defer
.
Web UI Testing With Go | Inkmi
How to test your Web UI in pure Go, without accessing any rendering engine (and thus avoid tools or services like Cypress, Selenium or Playwright).
Runes in GO. If you’re new to Go, you might have… | by Raghav Joshi | Jul, 2024 | Medium
Go has first-class Unicode support. Here is an intro to the basic Unicode entity, a rune.
What’s New in Go 1.23: Iterators and reflect.Value.Seq · The Ethically-Trained Programmer
For Go 1.23, Carlana Johnson proposed four new methods: reflect.Value.Seq
, reflect.Value.Seq2
, reflect.Type.CanSeq
, and reflect.Type.CanSeq2
. In this article, she explains the rationale behind the new methods and how they work.
HTTP/0.9 From Scratch
Wait, what? HTTP/0.9? Yes, and why not? If you want to learn HTTP, start from the simplest version. More articles will come to this HTTP series by Kevin McDonald.
gRPC Over HTTP/3
HTTP/3? Yes please! gRPC with HTTP/3? Umm, that's a more complicated story. Let Daniel Lundin list the advantages of HTTP/3 and walk you through a gRPC-over-HTTP/3 server in Go.
How To Create A Blog Using Golang - YouTube
Build a (dynamic) blog in Go with MBV Labs, a.k.a. Morten Vistisen. This is a mini series, with two episodes being out already (as of this writing), and an upcoming episode about deployment is in the works.
Go Quiz
Test your Go knowledge with these (trick) questions! Switch to presenter mode to see the answers (in the slide notes).
Gist of Go: Concurrency
Anton Zhiyanov is writing a book about concurrency. Here are some sample chapters with code that you can execute right on the page.
Building static binaries with Go on Linux
Whoa, wait! Doesn't Go create static binaries by default?
Well, not quite. At least, not on Linux, if your code makes DNS lookups or user and group ID lookups. Go reaches out to the C library for these tasks. Two solutions exist: Set GCO_ENABLED to 0, or link libc
statically with Go. Eli Bendersky shows two ways of linking libc
with Go statically.
Union of Finite Automata
Or: Academic thinking versus programmer thinking.
Projects
Libraries
GitHub - ghoshRitesh12/brooktube: An unofficial YT Music scraper package
This package was made for a TUI music player named Brook.
GitHub - guycipher/btree: An embedded, concurrent, disk BTree written in GO. BTree is optimized for fast search and key's with many values.
The BTree data structure (and versions thereof) is popular for creating database indexes. Here is a concurrency-safe, disk-based implementation (work in progress).
GitHub - sysulq/dataloader-go: Go implementation of Facebook's DataLoader with 200+ lines of code.
Facebook's DataLoader is kind of an abstraction layer for data fetching, aiming to provide consistent semantics across various data sources. This is an implementation in (and for) Go.
Tools and applications
GitHub - souhail-5/zeed: Zeed, a CLI tool to prevent changelog-related merge conflicts
Do you frequently encounter Git merge conflicts purely because of a changelog file being updated in multiple branches simultaneously?
Zeed is a change logger that does not write to the changelog file directly but rather to a file in the staging area. Before the merge, Zeed unifies all staged entries into the changelog file.
GitHub - kocierik/k8s-to-diagram: generate a diagram architecture from kubernetes manifest
Has your Kubernetes cluster become overwhelmingly complex? Turn your Kubernetes YAML manifests into a nice diagram and find your way through your cluster again.
GitHub - dweymouth/supersonic: A lightweight and full-featured cross-platform desktop client for self-hosted music servers
A music player for Subsonic/OpenSubsonic or Jellyfin music servers, with a fine (or, fyne) GUI.
GitHub - ZeppelinMC/Zeppelin: Blazingly fast Minecraft 1.21 server
A Minecraft server in Go! Still a WIP, but promsing!
GitHub - maelstrom-software/maelstrom: Maelstrom is a fast Rust and Python test runner that runs every test in its own container. Tests are either run locally or distributed to a clustered job runner.
Run tests in containers, with the option to distribute test runs. Maelstrom works with Go, Rust, and Python tests.
GitHub - Abi-Liu/TextTunnel: A real time chat application based in the terminal
While the author's main object of this project was to explore the world of TUI app development, the side effect is a responsive real-time chat system. Not bad!
sako: Sako is a Wallabag-compatible articles safekeeper
Bookmark web pages for reading them later! Sako is compatible to the "grande dame of open-source bookmark managers", Wallabag, in two ways: It can import articles, tags, annotations and tagging rules from Wallabag, and it offers a Wallabag-compatible API.
GitHub - karl-cardenas-coding/mywhoop: A tool for gathering and retaining your own Whoop data.
Do you use a Whoop fitness tracker? This utility downloads your Whoop data via API.
Completely unrelated to Go
Backward compatibility, even for settings, has real costs
When software evolves, configuration options may change over time. Keeping obsolete settings alive for the sake of not breaking users' config files may considerably slow down and complicate software development, warns Chris Siebenmann.
80% of developers are unhappy. The problem is not AI, nor is coding
Developers aren't happy with their jobs anymore. And no, it's not due to AI. Nor is it due to developing code. The main reasons are mostly outside of the affected developers' control.
The New Internet
Lack of direct connectivity is one of the reasons the internet became so heavily centralized as it is today. Spanning a VPN over your infrastructure helps regain control and remove layers of centralization-induced communication complexity. By Avery Pennarun.
(This article is by and about Tailscale, but its conclusion applies to any VPN solution of that kind: NetBird, ZeroTier, plain WireGuard… you name them.)
just disconnect the internet
"Security-relevant systems shouldn't connect to the internet!" said some people after the CrowdStrike incident. As if this were easy, or even possible.
P.S.
Did you know that sending and receiving emails emits about 1344.3 tons of carbon dioxide every single day?
This information reached me just when I (once again) thought about beefing up the newsletter with images and visuals. But then, carbon emissions are another good reason to stay with text-only news. (The primary reason so far was that images naturally don't show in plain-text email readers. (Unless I asked an AI to turn each image into an ASCII art. But that's just another way of increasing carbon emissions.))
Happy coding! ʕ◔ϖ◔ʔ
Questions or feedback? Drop me a line. I'd love to hear from you.
Best from Munich, Christoph
Not a subscriber yet?
If you read this newsletter issue online, or if someone forwarded the newsletter to you, subscribe for regular updates to get every new issue earlier than the online version, and more reliable than an occasional forwarding.
Find the subscription form at the end of this page.
How I can help
If you're looking for more useful content around Go, here are some ways I can help you become a better Gopher (or a Gopher at all):
On AppliedGo.net, I blog about Go projects, algorithms and data structures in Go, and other fun stuff.
Or visit the AppliedGo.com blog and learn about language specifics, Go updates, and programming-related stuff.
My AppliedGo YouTube channel hosts quick tip and crash course videos that help you get more productive and creative with Go.
Enroll in my Go course for developers that stands out for its intense use of animated graphics for explaining abstract concepts in an intuitive way. Numerous short and concise lectures allow you to schedule your learning flow as you like.
Christoph Berger IT Products and Services
Dachauer Straße 29
Bergkirchen
Germany