Dummy load balancer in a single Go script

I was curious to see if I could prototype a simple load balancer in a single Go script. Go’s standard library and goroutines make this trivial. Here’s what the script needs to do: Spin up two backend servers that’ll handle the incoming requests. Run a reverse p...

Dummy load balancer in a single Go script

I was curious to see if I could prototype a simple load balancer in a single Go script. Go’s standard library and goroutines make this trivial. Here’s what the script needs to do: Spin up two backend servers that’ll handle the incoming requests. Run a reverse p...

Go 1.22's (likely) new <code>reflect.TypeFor()</code> generic function

'There will not be a Go 2 that breaks Go 1 programs.'

#​473 — August 29, 2023 Unsub  |  Web Version 👋 We're back! Well, almost.. If you didn't get an issue of Go Weekly in the past few weeks, don't worry, I was on vacation. I'm technically on vacation for a couple more days but didn't want too many issu...

Perfectly Reproducible, Verified Go Toolchains

Go 1.21 is the first perfectly reproducible Go toolchain.

Slices Package: Compare

Series Here are all the posts in this series about the slices package. Binary Search Clip, Clone, and Compact Compare Contains, Delete, and Equal Introduction In the last post of this series I discussed the Clip, Clone, and Compact APIs from the slices package. In this post, I wi...

My favorite prime number generator

Many years ago I've re-posted a Stack Overflow answer with Python code for a terse prime sieve function that generates a potentially infinite sequence of prime numbers (&quot;potentially&quot; because it will run out of memory eventually). Since then, I've used this code many tim...

Limit goroutines with buffered channels

I was cobbling together a long-running Go script to send webhook messages to a system when some events occur. The initial script would continuously poll a Kafka topic for events and spawn new goroutines to make HTTP requests to the destination. This had two problems: It could cr...

Limit goroutines with buffered channels

I was cobbling together a long-running Go script to send webhook messages to a system when some events occur. The initial script would continuously poll a Kafka topic for events and spawn new goroutines to make HTTP requests to the destination. This had two problems: It could cr...

Structured Logging with slog

The Go 1.21 standard library includes a new structured logging package, log/slog.