Master and Understand Go Language Deeply and Build Go Programs from Scratch. 10+ Projects, 1000+ Exercises, and more.

Get the course now with the link below:

👉 ★ Go Bootcamp: Online Go Course ★

What does the course include?

Image for post
Image for post

Gotchas and tricks about defer.

Image for post
Image for post

This article is more about tricks rather than gotchas of defer.

Read the following posts from this series to discover more gotchas and tricks about defer:

If you don’t know how defer works please read this starter post first:

Learn about everything I covered so far in the last year.

Image for post
Image for post


In this article I’m going to cover what happened in 2017 and what will happen in 2018. And also, I’ve created a path for you to follow, so you can read my articles in order to digest them easily.


After working days, nights, weeks, weekends, and months fulltime educating people about Go for 3 months, this happened:

  • I wrote 100,000 words in total (After edits: 20,000 words in total)
  • 2.500+ unique people followed me
  • 1.300+ people followed my blog
  • 500+ people subscribed to my e-mail list (Join here)
  • 800+ people followed me on Medium
  • 500+ people followed me on…

Protect yourself from basic defer gotchas.

Image for post
Image for post

🐼 This article is only for beginner to intermediate level Gophers, masters: “close the tab please”.

#1 — Deferred nil func

If a deferred func evaluates to nil, execution panics when the surrounding func ends not when defer is called.

Learn about Golang’s defer statement with various usage examples.

Image for post
Image for post

What is defer?

It takes a func and executes it just before* the surrounding func returns whether there is a panic or not.

Do you want to know the man behind the curtains?

Image for post
Image for post

Alright, that’s all for now. Thank you for reading so far.

Let’s stay in touch:

An overview of anonymous, higher-order, closures, concurrent, deferred, and other kinds of Golang funcs.

Image for post
Image for post

This post is a summary for the different kind of funcs in Go. I’ll go into more detail in the upcoming posts because they deserve more. This is just a start.

Learn everything about Golang variadic funcs with common usage patterns.

Image for post
Image for post

What is a variadic func?

A variadic func accepts variable number of input values — zero or more. Ellipsis (three-dots) prefix in front of an input type makes a func variadic.

Easily understand Go funcs with visuals.

Image for post
Image for post

Note: This guide is only about introducing Go functions, not about: variadic, defer, and external funcs; or methods, http, and marshaling, etc.

What is a function?

A function is a separate and reusable block of code which can be run again and again. Functions may accept input values and they may return output values.


Inanc Gumus

Coder. Gopher. Maker. Stoic. Since 1993.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store