Roast topics
Find topics
Roast it!
Roast topics
Find topics
Find it!
Login
From:
danp.net
(Uncensored)
subscribe
Reducing nesting in Go functions with early returns · Dan Peterson
https://danp.net/posts/reducing-go-nesting/
links
backlinks
One of my favorite localized Go refactorings is reducing nesting by using return as early as possible. Take this example, based on a recently-refactored function at Heroku: