Blog on Applied Gohttps://appliedgo.net/Recent content in Blog on Applied GoHugo -- gohugo.ioen-usChristoph Berger[email protected]This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.Thu, 14 Dec 2023 17:22:58 +0100From Go Code to Homebrew Tap: Writing and Deploying a Whisper CLI with GoReleaserhttps://appliedgo.net/whisper-cli/Mon, 03 Mar 2025 00:00:00 +0000[email protected]https://appliedgo.net/whisper-cli/ If an existing tool is not straightforward to use, a software developer's natural reflex is to write a tailor-made CLI. Akash Joshi wrapped OpenAI's Whisper model into an intuitive command-line interface, packaged it with GoReleaser, and distributed it via Homebrew. Here are the steps for you to steal.Beyond the Debugger: A Comprehensive Guide to Debugging Go Applicationshttps://appliedgo.net/debug/Sat, 15 Feb 2025 00:00:00 +0000[email protected]https://appliedgo.net/debug/ Not all bugs are created equal. Some may be easy to pinpoint and eliminate with the help of a debugger. Others might be subtle or infrequent, and tracking them down is like searching for a needle in a haystack. Choosing the right debugging technique can significantly raise the chance of success while reducing the time to get there.Go One-Two-Three: My Favorite Features of Go Release 1.23https://appliedgo.net/go123/Wed, 14 Aug 2024 00:00:00 +0000[email protected]https://appliedgo.net/go123/ TL;DR: Go now officially supports ranging over function iterators, adds opt-in telemetry, is WAY faster when building with Profiled Guided Optimization enabled, fixes garbage collection of tickers and timers, and provides useful updates to many packages of the standard library. Get it while it's hot!Distributed Computing With Dried, Salted Cod Fish, WASM, And (Tiny)Gohttps://appliedgo.net/bacalhau/Sat, 02 Mar 2024 00:00:00 +0000[email protected]https://appliedgo.net/bacalhau/ You don't need monstrous software orchestration systems for collecting information from distributed data sources. Here is an easy way of sending a Go binary to where the data is.SQL as API in Gohttps://appliedgo.net/sqlasapi/Mon, 01 Jan 2024 00:00:00 +0000[email protected]https://appliedgo.net/sqlasapi/ So your API needs to allow queries that are too complicated for plain CRUD APIs but not complicated enough to justify using GraphQL? Consider accepting a subset of SQL where clauses, with the necessary security checks implemented in Go.Continuous refresh, or: how to keep your API client authorizedhttps://appliedgo.net/refresh/Wed, 18 Oct 2023 00:00:00 +0000[email protected]https://appliedgo.net/refresh/ An access token should be initialized and refreshed from a central place, yet be available to umpteenth of client sessions. Dynamic futures to the rescue.Poetry time! Go proverbs as limerickshttps://appliedgo.net/limericks/Thu, 08 Dec 2022 00:00:00 +0000[email protected]https://appliedgo.net/limericks/ The Go proverbs capture the essence of Go. Too concise for your taste? No worries, here is each proverb explained in a limerick.AI times three—or how I made AI write a blog post for mehttps://appliedgo.net/ai-times-three/Sat, 03 Dec 2022 00:00:00 +0000[email protected]https://appliedgo.net/ai-times-three/ Writing a concurrency-safe hashmap in Go is dead easy, even an AI can do it! To prove this, I had three AI tools write this blog article, generate Go code, and create an opening image.How I used Go to make my radio auto-switch to AUX-IN when a Raspi plays musichttps://appliedgo.net/auxin/Sat, 20 Aug 2022 00:00:00 +0000[email protected]https://appliedgo.net/auxin/ Ok, so your radio lacks AirPlay support but has an auxiliary input and can be remote-controlled via the Frontier Silicon API. Fetch a Raspberry Pi, put Shairport-sync and Raspotify on it, plug it into the AUX port, and glue everything together with some Go code. Et voilà - home automation in the small.Rapid AWS Lambda development with Go and Mantilhttps://appliedgo.net/mantil/Fri, 28 Jan 2022 00:00:00 +0000[email protected]https://appliedgo.net/mantil/ If you need to develop an AWS Lambda function in Go, take a look at Mantil, a dev kit with staging and database connection included.Instant Gohttps://appliedgo.net/instantgo/Sat, 04 Sep 2021 00:00:00 +0000[email protected]https://appliedgo.net/instantgo/ Edit and run Go code right in the browser. No backend required.How I turned a binary search tree into a generic data structure with go2gohttps://appliedgo.net/generictree/Wed, 07 Jul 2021 00:00:00 +0000[email protected]https://appliedgo.net/generictree/ Some time ago I wrote about how to create a balanced binary search tree. The search keys and the data payload were both plain strings. Now it is time to get rid of this limitation. go2go lets us do that while waiting for the official generics release.How to become the richest person on earth (and learn some Go along the way)https://appliedgo.net/rich/Wed, 02 Jun 2021 00:00:00 +0000[email protected]https://appliedgo.net/rich/ Ok, to be frank, this article is mostly about the second part of the title. We will build a market simulation with minimal Go code, and show how the rich get richer even when they are not greedy at all.Packaging a project release (goreleaser part 2)https://appliedgo.net/release2/Sat, 08 May 2021 00:00:00 +0000[email protected]https://appliedgo.net/release2/ In the previous post, I used goreleaser to add binaries to a project release. Now let's have goreleaser build a Homebrew formula as well. Automatically, and for macOS and Linux alike.CLI tools FTW (or: how to distribute your CLI tools with goreleaser)https://appliedgo.net/release/Sat, 24 Apr 2021 00:00:00 +0000[email protected]https://appliedgo.net/release/ “go get” is a super-simple way of installing Go binaries, but not everyone has a Go compiler installed. If you want to make your CLI tools and apps available to the world, have a look at goreleaser.Cannot import main: a Go Module gotchahttps://appliedgo.net/testmain/Sat, 28 Nov 2020 00:00:00 +0000[email protected]https://appliedgo.net/testmain/ Two questions for you: Do you name an app module simply “main”? And do you happen to write tests for a main package? If so, you are in big trouble! (Ok, that was a bit clickbait-ey…) Well, the world is not exactly going to end; however, you might encounter an unexpected error that is hard to track down.Futures in Go, no package requiredhttps://appliedgo.net/futures/Sat, 06 Jun 2020 00:00:00 +0000[email protected]https://appliedgo.net/futures/ Futures are mechanisms for decoupling a value from how it was computed. Goroutines and channels allow implementing futures trivially. Does this approach cover all aspects of a future?what.Happens - a debug logging package for developers onlyhttps://appliedgo.net/what/Sun, 12 Apr 2020 00:00:00 +0000[email protected]https://appliedgo.net/what/ Package what provides some handy debug-logging functions that can be enabled and disabled via build flags. No more information leaks in your production code!Slow down your code with goroutineshttps://appliedgo.net/concurrencyslower/Sat, 13 Apr 2019 00:00:00 +0000[email protected]https://appliedgo.net/concurrencyslower/ Or: How adding goroutines can keep your CPU busy shuffling things around.In the news: Go on AWS Lambdahttps://appliedgo.net/awslambda/Sun, 28 Jan 2018 00:00:00 +0000[email protected]https://appliedgo.net/awslambda/ Just recently, Amazon announced support for Go on AWS Lambda. Here is a summary of last week's news around this topic.How to Create PDF Documentshttps://appliedgo.net/pdf/Tue, 16 Jan 2018 00:00:00 +0000[email protected]https://appliedgo.net/pdf/ Pure data is for computers and nerds like you and me. Anyone else likes nicely formatted reports. Go and a good PDF package can help.Processing spreadsheet data in Gohttps://appliedgo.net/spreadsheet/Mon, 04 Dec 2017 00:00:00 +0000[email protected]https://appliedgo.net/spreadsheet/ Your managers, all through the hierarchy, love circulating spreadsheets via email. (They simply don't know better.) How to extract and analyze the relevant data from the daily mess? Go can help.A DIY Dashboard with Grafanahttps://appliedgo.net/diydashboard/Mon, 30 Oct 2017 00:00:00 +0000[email protected]https://appliedgo.net/diydashboard/ If your code creates some stats to monitor, Grafana and the Grada package may come in handy.Go slices are not dynamic arrayshttps://appliedgo.net/slices/Thu, 03 Aug 2017 00:00:00 +0000[email protected]https://appliedgo.net/slices/ Go's slices are cleverly designed. They provide the look-and-feel of truly dynamic arrays while being optimized for performance. However, not being aware of the slice mechanisms can bring you into trouble.goman - the missing man pages for Go binarieshttps://appliedgo.net/goman/Mon, 26 Jun 2017 00:00:00 +0000[email protected]https://appliedgo.net/goman/ Most Go binaries come without any man page. The tool goman fills this gap. If the corresponding project includes a decent README file (and most projects do), goman find this README file and displays it on the terminal.Controlling a Digispark boardhttps://appliedgo.net/digispark/Sun, 21 May 2017 00:00:00 +0000[email protected]https://appliedgo.net/digispark/ The Digispark is perhaps as small as a microcontroller board for DIY electronics can get. This is a short writedown about my first experiences with controlling this board through Go code, using Gobot and LittleWire.Big Oh!https://appliedgo.net/big-o/Mon, 01 May 2017 00:00:00 +0000[email protected]https://appliedgo.net/big-o/ You worked hard to save a few CPU cycles in the central loop, but your code is still slow? Time to think about the time complexity of your algorithm.Text-Based User Interfaceshttps://appliedgo.net/tui/Sun, 02 Apr 2017 00:00:00 +0000[email protected]https://appliedgo.net/tui/ Want to equip your command-line application with a nice visual user interface? TUI libraries are here to help.Flow To Gohttps://appliedgo.net/flow2go/Sat, 11 Mar 2017 00:00:00 +0000[email protected]https://appliedgo.net/flow2go/ If you want to do Flow-Based Programming in Go, there are a couple of frameworks and libraries available. Or you simply do it with pure Go. After all, how difficult can it be?Get into the flowhttps://appliedgo.net/flow/Sat, 25 Feb 2017 00:00:00 +0000[email protected]https://appliedgo.net/flow/ In Flow-Based Programming, programs are modeled as data flowing between independent processing units. Who would not think of channels and goroutines as a natural analogy?TCP/IP Networkinghttps://appliedgo.net/networking/Wed, 25 Jan 2017 00:00:00 +0000[email protected]https://appliedgo.net/networking/ Connecting two processes at TCP/IP level might seem scary at first, but in Go it is easier than one might think.Picturesque!https://appliedgo.net/imageprocessing/Thu, 22 Dec 2016 00:00:00 +0000[email protected]https://appliedgo.net/imageprocessing/ Let's face it: Pictures taken with a smartphone usually aren't quite like Ansel Adams masterpieces. But with a little post-processing, some of them might still reveal their true beauty. A couple of Go libraries can help.MapReduce - munching through Big Datahttps://appliedgo.net/mapreduce/Fri, 02 Dec 2016 00:00:00 +0000[email protected]https://appliedgo.net/mapreduce/ How Google tackled the problem of processing enormous amounts of data, and how you can do the same with Go.Deliver my data, Mr. Json!https://appliedgo.net/json/Thu, 27 Oct 2016 00:00:00 +0000[email protected]https://appliedgo.net/json/ JSON is the lingua franca of exchanging data over the net and between applications written in different programming languages. In this article, we create a tiny JSON client/server app in Go.A Random Blog Posthttps://appliedgo.net/random/Tue, 11 Oct 2016 00:00:00 +0000[email protected]https://appliedgo.net/random/ How to generate random numbers, and the difference between math/rand and crypto/rand.Take a REST!https://appliedgo.net/rest/Wed, 14 Sep 2016 00:00:00 +0000[email protected]https://appliedgo.net/rest/ RESTful Web API's are ubiquitous. Time for a minimalistic, five-minutes video tutorial about REST, RESTful API's, and buidling a REST server in Go.Regular Expressions demystifiedhttps://appliedgo.net/regexp/Mon, 29 Aug 2016 00:00:00 +0000[email protected]https://appliedgo.net/regexp/ Regular Expressions are slow, ugly, error-prone, incomprehensible,… Or are they? Find out by learning regexp basics.Balancing a binary search treehttps://appliedgo.net/balancedtree/Sat, 13 Aug 2016 00:00:00 +0000[email protected]https://appliedgo.net/balancedtree/ Only a well-balanced search tree can provide optimal search performance. This article adds automatic balancing to the binary search tree from the previous article.A Binary Search Treehttps://appliedgo.net/bintree/Sat, 06 Aug 2016 00:00:00 +0000[email protected]https://appliedgo.net/bintree/ Search trees are everywhere: In databases, in file systems, in board game algorithms,… This post explores the probably most basic form of a tree: a binary search tree.Who needs generics? Use ... instead!https://appliedgo.net/generics/Thu, 14 Jul 2016 00:00:00 +0000[email protected]https://appliedgo.net/generics/ What are generics? Why are they considered useful? Why does Go have no generics? What shall Gophers use instead? This article examines the nature of generics, and surveys various techniques that can be used to work around the absence of this programming paradigm.Plugins in Gohttps://appliedgo.net/plugins/Thu, 30 Jun 2016 00:00:00 +0000[email protected]https://appliedgo.net/plugins/ Go is a statically compiled language. The Go runtime cannot load dynamic libraries, nor does it support compiling Go on the fly. Still, there is a number of ways of creating and using plugins in Go.Dependency Injection in a nutshellhttps://appliedgo.net/di/Thu, 23 Jun 2016 00:00:00 +0000[email protected]https://appliedgo.net/di/ Layered software architectures adhere to the Dependency Rule: Source code in a lower-level layer can make use of code in higher-level layers, but never vice versa. Control flow, however, goes in both directions. How is this possible, given that higher-level code must not know anything about the code in lower levels?Inverse Kinematics: how to move a robotic arm (and why this is harder than it seems)https://appliedgo.net/roboticarm/Thu, 16 Jun 2016 00:00:00 +0000[email protected]https://appliedgo.net/roboticarm/ So you have built a robotic arm? Great, let's write some Go to make it serve your five o'clock tea. Sounds simple enough. Or is it?Perceptrons - the most basic form of a neural networkhttps://appliedgo.net/perceptron/Thu, 09 Jun 2016 00:00:00 +0000[email protected]https://appliedgo.net/perceptron/ Artificial Neural Networks have gained attention during the recent years, driven by advances in deep learning. But what is an Artificial Neural Network and what is it made of? Meet the perceptron.Message Queues Part 2: The PubSub Protocolhttps://appliedgo.net/pubsub/Thu, 02 Jun 2016 00:00:00 +0000[email protected]https://appliedgo.net/pubsub/ This is the second (and, for the time being, the last) article about messaging and Mangos. After doing first steps with the Pair protocol, we now look into a slightly more complex protocol, the Publisher-Subscriber (or PubSub) protocol.Message Queues, or how you can make processes talk to each otherhttps://appliedgo.net/messaging/Fri, 27 May 2016 00:00:00 +0000[email protected]https://appliedgo.net/messaging/ Consider two processes that need to exchange commands and data. You want to connect them in a way that is straightforward, efficient, and reliable. How would you do that? Enter Message Queues.