Configuring options in Go
Compare three Go option patterns: exposed structs, option constructors, and functional options. Learn when to use each for clean APIs.
Compare three Go option patterns: exposed structs, option constructors, and functional options. Learn when to use each for clean APIs.
When you're writing pure net/http HTTP services with Go, you may want to wrap them in a middleware, for instance to ensure that authentication is provided, or to provide logging. Having largely just used gorilla/mux, I found it was a little bit awkward to do so, but with thanks t...
As noted in Why is Go trying to upgrade my go.mod to Go 1.21?, we've had a report on oapi-codegen that Go is trying to upgrade our go.mod to a newer Go version. Through discussion in the Go community (Gopher) Slack, it appears that this is due to one of the modules in my dependen...
On oapi-codegen we recently had a report that Go 1.21 results in go test being unable to run without having go mod tidy'd the project. If you're running Go 1.21: $ go version go version go1.21.0 linux/amd64 Then checking out the project (as of the latest commit and running make t...
I was on episode 289 of the Go Time podcast, talking about What’s New in Go 1.21. Check it out!
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...
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...
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...
Build a working round-robin load balancer in Go with goroutines and the standard library. No dependencies needed for this educational prototype.