Skip to content

Glossary: Go Basics

defer

Schedules a call to run just before the current function returns, however it returns. `defer f.Close()` right after opening a file makes sure the file is closed.

Where the book teaches it

Related terms

os.Open and os.Create