A generic Set type in Go
To celebrate the first anniversary of generics in Go, let’s build something practical and useful: a generic Set type, and add some neat methods to it. Ready for fun?
To celebrate the first anniversary of generics in Go, let’s build something practical and useful: a generic Set type, and add some neat methods to it. Ready for fun?
Introduction In episode 6, Miki built a logger package with the aim of making it as versatile as possible. To achieve this, he constructed his logger object with a function that would: accept the io.Writer interface as a parameter and perform type assertions to retrieve other int...
As written about in Automating boilerplate/scaffolding code with custom code generation in Go, being able to take advantage of generating Go code can be super handy. However, you may get to the point where you're working with the codegen that you find working with text-based temp...
Sometimes when you're integrating with APIs or web services, you need to debug the HTTP requests/responses that are occuring. In some toolchains it's part of configuration, but in Go it's unfortunately not part of the standard library to globally turn on logging for the http.Clie...
Introduction One of the exercises I give to students is to download a single big file over HTTP concurrently using several goroutines using HTTP Range requests. An extra part of the exercise is to validate the downloaded file from a known MD5 signature. This extra part turns out...
with Cheikh Seck Introduction This is the first in a series of posts that will explore the Rust programming language. I am going to take the same approach I did with Go and write little programs that explore the different features of the language. Before I begin that work, I thou...
One of my favorite things about the recent Go 1.20 release is the new http.ResponseController type, which brings with it three nice benefits: You can now override your server-wide read and write deadlines on a per request basis. The pattern for using the http.Flusher and http...
Introduction In episode 5, Miki wrote a function that counted the number of lines in a file with interfaces. The first thing his function did was to open a file with Go’s os.Open function. Miki chose this method because the variable returned by said function implements the io.R...
The February release got a little late… better later than even later, I guess! 😄 goreleaser healthcheck It is packed with some juicy features and tons of bug fixes and quality-of-life improvements. Let’s take a look: Highlights On GoReleaser Pro y...