Closures in Go

This is a 3 part series composed of the following articles:

1. What is a Closure?

An explanation of what anonymous functions and closures are, along with examples of how to create and use them in Go (aka Golang).

2. 5 Useful Ways to Use Closures in Go

Explore five different real world use cases for closures that will help you understand and utilize closures better in your own code.

3. Gotchas and Common Mistakes with Closures in Go

This article explores a couple easy to make but hard to debug mistakes that can be made when working with closures in Go, and explains how to avoid them.

Learn Web Development with Go!

Sign up for my mailing list and I'll send you a FREE sample from my course - Web Development with Go. The sample includes three chapters from the book, and over 2.5 hours of screencasts.

You will also receive notifications when I release new articles, along with other freebies that I only share with my mailing list.

Avatar of Jon Calhoun
Written by
Jon Calhoun

Jon Calhoun is a full stack web developer who also teaches about Go, web development, algorithms, and anything programming related. He also consults for other companies who have development needs. (If you need some development work done, get in touch!)

Jon is a co-founder of EasyPost, a shipping API that many fortune 500 companies use to power their shipping infrastructure, and prior to founding EasyPost he worked at google as a software engineer.

Spread the word

Did you find this page helpful? Let others know about it!

Vote on Hacker News

Sharing helps me continue to create both free and premium Go resources.

Want to discuss the article?

See something that is wrong, think this article could be improved, or just want to say thanks? I'd love to hear what you have to say!

You can reach me via email or via twitter.

Recent Articles All Articles Mini-Series Tags About Me Go Courses

©2018 Jonathan Calhoun. All rights reserved.