Where is the deferral request processed?
I would like to know how and why the deferred operator works and where it is implemented (in the compiler source code).
I found a package about parsing defer-Statement and plotting it in a syntax tree
But I am interested in actually outputting the deferral at runtime. I assume it is somewhere inside "src / runtime"
+3
source to share
1 answer
Start reading here https://github.com/golang/go/blob/d089a6c7187f1ff85277515405ec6c641588a7ff/src/runtime/panic.go#L70
You can also search the repository for the term "deferreturn" for more results.
The build for delayed jumps is here https://github.com/golang/go/blob/master/src/runtime/asm_amd64.s#L550
+5
source to share