/explore

Click through on any links that interest you or select the planets on the right to continue exploring the Outer Web.
You are here

jbrandhorst.com
| | hypirion.com

Go has phantom types, and we can use them to attach singletons to contexts. Here is a short post on how to do just that.
5.4 parsecs

Travel
| |
| | konradreiche.com

Starting a goroutine is as easy as adding the go keyword in front of a method, but managing the lifecycle of a goroutine is not. If you only need to start a few goroutines and wait for their completion, you are off the hook thanks to sync.WaitGroup. However, what if a goroutine has to run for a specific duration or repeatatly in a loop until the initiating code terminates? Does it matter? After all, if the main goroutine terminates, any other goroutine will also stop. It does matter, because depending on what the goroutines are doing, it might leave your system in an inconsistent or invalid state. Channels are a commonly used to signal to a goroutine that it can shut down, but I often see the use of a signaling channel, for example chan bool or chan struct{}...
3.0 parsecs

Travel
| |
| | pauladamsmith.com

This is a simple and easily generalizable way to put an upper-bound on the maximum number of simultaneous clients to a Go net/http server or handler. The idea is to use a counting semaphore, modeled with a buffered channel, to cause new clients to...
2.8 parsecs

Travel
| |
| | blog.healthchecks.io

In this guide, I will deploy a Healthchecks instance on a VPS. Here's the plan: Use the official Docker image and run it using Docker Compose. Store data in a managed PostgreSQL database. Use LetsEncrypt certificates initially, and load-balancer-managed certificates later for a HA setup.
21.2 parsecs

Travel
|