The Applied Go Weekly Newsletter logo

The Applied Go Weekly Newsletter

Subscribe
Archives
April 14, 2024

Choose your language wisely! • The Applied Go Weekly Newsletter 2024-04-14

AppliedGoNewsletterHeader640.png

Your weekly source of Go news, tips, and projects

Choose your programming language wisely! Those of you who already have worked with several languages know what I mean. I reckon you won't disagree when I say that Go is a wise choice for many requirements. The latest Go Developer Survey results support this: 93% of the respondents are satisfied with Go. And, as I'll expand on in the essay below (which replaces the Go Tip section this week), a well-designed language (and this includes the tooling) provides many ways to help shortening development cycles.

Now, as you read this newsletter, I reckon you already have made your choice.

Happy coding!

Go Developer Survey 2024 H1 Results - The Go Programming Language

Developer sentiment is high, devs trust the Go team to do the right thing, and many see Go as a good fit for AI applications. I say: go, Go, go!

Go Developer Survey 2024 H1 Results - The Go Programming Language

Minesweeper written in Go using Fyne

A desktop UI framework is probably not the first choice for writing a game, but some types of game don't need a full-fledged game engine.

Minesweeper written in Go using Fyne

Building a RAG for tabular data in Go with PostgreSQL & Gemini – P. Galeone's blog

RAG == Retrieval-Augmented Generation == Let an LLM search through data to answer your questions.

Building a RAG for tabular data in Go with PostgreSQL & Gemini – P. Galeone's blog

Podcast corner

Good news for all his fans: Bill Kennedy (of Ardan Labs fame) is guest on two podcasts this week.

Cup o' Go

What's not covered by this episode's title: Hugot — Huggingface pipelines for Go, and Jonathan's article about the real reasons why the Net Promoter Score (NPS) fails to deliver.

Cup o' Go | All about community - Dev Survey, Meetup Roundup, and talking with Bill Kennedy

Go Time

Do you use goreleaser, the highly versatile install package builder for Go? Then don't miss this Go Time episode, where Carlos Becker, the creator of goreleaser talks with host Natalie Pistunovich about Go for X, where X = shipping bundles, home automation, DevOps, AI, and more.

Ship software, not code featuring Carlos Becker (Go Time #311)

go podcast()

Encore is a backend development platform with a few interesting extras. Bill Kennedy talks to Dominic St-Pierre about his experiences with Encore, about domain design and how to architect an isolated system.

go podcast() | 034: Encore, domain design in Go with Bill Kennedy

Essay: Use Go, ship fast

Lately, I came across this article: I asked 100 devs why they aren’t shipping faster. Here’s what I learned - Greptile. Just reading the article had a question pop into my mind:

To what extent do programming languages influence the time to ship a product (or a new release)?

The article is a great starting point for answering this question, so I started going through the reasons discussed there.

Dependency bugs

The first reason is already an area where Go shines. Go has a rich standard library that greatly reduces the need for grabbing a third-party library (left-pad, anyone?), and a community that appears to not be very dependency-happy, either. The spirit of choosing one's dependency carefully is even baked into the Go proverbs: "A little copying is better than a little dependency."

Complicated codebase

Let's face it: It's possible to create horribly complicated and convoluted codebases in any language. The reasons for code bloat occur at a different level. Nevertheless, some language features can help fighting complexity and the resulting decay of a codebase. Let's look at some problems the article lists:

  • Missing or outdated documentation: Time pressure lets teams skip writing and maintaining documentation. A language that supports in-place code documentation provides at least a means to effortlessly document the intentions behind a particular function or package. In Go, you can add comments to packages, types, or functions, and Go turns them into a nicely formatted documentation ready for publishing at pkg.go.dev.
  • Cross-language repositories: Working in multiple languages simultaneously drains energy and slows down progress. I play three music instruments, and I play them miserably. Had I put all my efforts into getting good at a single one instead, I would be able to play music that people would not run away from. Likewise, I believe that knowing a ton of languages superficially cannot lead to coding excellence. Rather, deep knowledge in one particular language will get you forward faster, and farther.

QA loops, waiting for spec, and awaiting stakeholder approval

The article goes on listing three reasons that the programming langauge has no influence on: Slow QA processes, slow spec approvals, and slow updates/feedback from stakeholders. To sum it up: Waiting for others.

Writing tests

To problems manifest around tests: Writing not enough tests, and writing bad tests. I think I can safely conclude that Go does a great job here. Unit testing is built into the language, the toolchain, and the community spirit. (The latter is my perception, but I think I'm not too far off.) Go eliminates the need for learning a test language (just use plain Go), as well as the need for installing a test toolkit (just use the Go toolchain).

Development/build speed

Do I need to write anything here? Go is known for short development cycles, thanks to being a boring language with a darn fast compiler.

All reasons in the "People" section

The following section in the article lists various reasons that are purely a "people" thing. Whatever programming language you use, slow PR reviews, scope creep, unclear requirements, or excessive meetings can severely hamper progress of any project.

Motivation

Motivation to work on a project depends to a great extent on the people you work with and the culture that the team or company lives. But still, isn't the anticipation of writing Go code enough motivation for standing up each morning?!

Surely it is.

Quote of the week: Layers

Every problem can be quickly solved by adding another layer, and then another, and another…

– Lukasz Mierzwa

More articles, videos, talks

P99 CONF 2024: Call for Speakers @ Sessionize.com

P99Conf, a conference about all things performance, is looking for speakers. (Sessions will be delivered pre-recorded.)

Building In-Memory Cache in Go – Mohit Khare

Sure, you can use Redis or SQLite to build an in-memory cache. But for small-scale caching, why not go lightweight with a simple map[string]any?

More on the Performance of Go Pointers - YouTube

Software Chat's third video on values vs pointers.

Creating a ring buffer using Go Channels for Server-Sent Events

I don't know if channels are the best way of implementing a ring buffer, but the point of this article is that the author shares some learnings around modeling concurrent activities.

Range-Over Functions in Go

The rangefunc experiment, explained by Miki Tebeka.

Fundamentals of I/O in Go: Part 2 | by Andrei Boar | Apr, 2024 | Medium

You certainly know io.Reader, but do you also know the multireader or the tee reader? (No, not: tea reader.) Andrei Boar presents some (maybe) less known I/O interfaces.

ETag and HTTP caching | Redowan's Reflections

Redowan Delowar shows how to make a Go web server advise the web clients to cache certain pages, using an ETag.

Projects

Libraries

GitHub - Thiht/go-command: go-command is a lightweight and easy to use library for creating command lines with commands and subcommands.

For anyone who doesn't need the full power of Cobra.

GitHub - creativecreature/sturdyc: caching library for building sturdy systems

"a highly concurrent cache that supports non-blocking reads and has a configurable number of shards to reduce lock contention during write operations."

GitHub - KardinalAI/gorabbit: Simplify RabbitMQ operations in Go with Gorabbit, a high-level wrapper for the official Go RabbitMQ plugin. Enhance your messaging workflow with a more straightforward interface and robust mechanisms, including an automatic "Always-On" mechanism for continuous connectivity.

Gophers and rab

GitHub - dolthub/go-mysql-server: A MySQL-compatible relational database with a storage agnostic query engine. Implemented in pure Go.

MySQL re-written in Go? Sure! Because you might want a drop-in replacement for in-memory testing or other interests.

GitHub - greencoda/confiq: Structured data format to config struct decoder library for Go

Populate structs or arrays from JSON, TOML, YAML, or environment variables.

Tools and applications

GitHub - 0jk6/cached: simple distributed key-value store using Raft

The author calls this project "probably the worst implementation of Raft"; yet, it seems to work as advertised.

GitHub - lunemec/1brc: 1️⃣🐝🏎️ The One Billion Row Challenge -- A fun exploration of how quickly 1B rows from a text file can be aggregated with Go

Yet Another Billion Row Challenge Contestant. The readme includes a comparison to other implementations, all measured on the same machine of course. This entry occupies a formidable second place among the selected entries.

GitHub - flipt-io/reverst: Reverse Tunnels in Go over HTTP/3 and QUIC

Expose your Go app to the public internet from within a shielded network. Includes a public server and a Go client library.

GitHub - OussamaM1/treels: ⚡ Treels is a CLI tool crafted in Go, merging tree and ls commands with intuitive merging and beautification features.

Take a (basic but color-enabled) ls command, combine it with tree, and here you have it: treels. List directory contents flat, as a tree, with or without icons.

GitHub - jorge-sepulveda/re4-pick-a-gun

Are you bored with choosing a gun in every new chapter in Resident Evil 4? Let Go pick a random gun for you.

I think this concept is heavily under-evaluated. Imagine an app that randomly picks a Go linter to run on every save. Or an app that picks a random weirdo to follow on X. Spice up your life with random decisions!

Completely unrelated to Go

Frontends need styling but no overboarding frameworks

For outsiders, the frontend world seems convoluted and confusing. The pile of CSS frameworks is only topped by the pile of JS frameworks. The number of possible ways to combine CSS and JS frameworks is mind-boggling. If you, as a backend developer, want or must write the frontend part you're doomed.

But there is hope. Small JS frameworks like HTMX push the complex application logic to the server side.

And for the styling, there's plain CSS.

Yes, plain CSS. Internal apps, for example, do not need to be super shiny and polished. And there is a lot you can achieve with a few lines of CSS. Don't believe me? Try Web Design in 4 minutes.

Web Design in 4 minutes

How CREAT got its E back

Once upon a time, IT resources were scarce: memory, CPU power, and the space for syscall names. Six letters were the maximum. This is why the CREAT call misses an... oh wait, "create" is only six characters long...!?

The creat [sic] Unix System Call

A deployment platform for minimalists

Over-engineering is the desease of our times. A typical deployment pipeline has more moving parts than this year's winner of the Rube Goldberg machine contest. Many small-to-medium backend projects could get away with a much simpler approach. How about running your project deployments with nothing more than AN EFFIN' THREE-AND-A-HALF DOZEN LINES OF SHELL SCRIPT?!

my deployment platform is a shell script

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.

Check it out.


Christoph Berger IT Products and Services
Dachauer Straße 29
Bergkirchen
Germany

Don't miss what's next. Subscribe to The Applied Go Weekly Newsletter:
LinkedIn
This email brought to you by Buttondown, the easiest way to start and grow your newsletter.