본문으로 건너뛰기
0

이 레슨은 당분간 영어로 제공돼요.

Clean up, no matter what

Open a file, lock a mutex, start a timer: each needs a matching cleanup. defer lets you write the cleanup right next to the setup, and Go runs it when the function returns, whichever path it takes.