How I write HTTP services in Go after 13 years

February 19, 2024

My thoughts

Interesting take on setting up an HTTP service. They mention that using grpc or different protocols might require to adjust the structure. I would be curious to get their take on a service supporting grpc and HTTP to help me revisit older decisions.

The signal.NotifyContext(ctx, os.Interrupt) approach to cancel context on interrupt is really an improvement over starting a goroutine and using Notify with a channel.

Best advice is to not use global scope to allow parallel testing without sporadic failures. Usinh os.GetEnv by passing a func(string) makes so much since.

Read the article: How I write HTTP services in Go after 13 years