The defer keyword in Go can seem mysterious at first: why do we need it? How do we use it? Let’s explore some common patterns that use defer to build robust, efficient programs by preventing resource leaks.
All tagged defer
The defer keyword in Go can seem mysterious at first: why do we need it? How do we use it? Let’s explore some common patterns that use defer to build robust, efficient programs by preventing resource leaks.
I spend a lot of time working with students to help them write clearer, better, and more useful Go programs, using a fairly small set of general principles, and here they are. The first is “be boring”, and I’ve tried to follow that advice.
Are you a grasshopper or a Go sensei? Can you wax on, wax off? Go mentor and would-be Mr Miyagi, John Arundel, explains how he grades his students using a system of coloured belts like those used in the martial arts. Find out how your skills compare to typical junior, mid-level, and senior devs!