6 ms·
one common use is the 'try/catch' mechanic. if a panic happens in go, and you want to be able to recover you'd use a defer. it's also used in the 'autoclosable
by dovholuknf 4y ago
one common use is the 'try/catch' mechanic. if a panic happens in go, and you want to be able to recover you'd use a defer.
it's also used in the 'autoclosable' type way. It's easy when opening a resource, to 'defer closing' them right then / there.
go takes a slow, methodical approach to feature changes. sometimes people think 'too slow', some think it's fine.
there are times when you 'defer' and you think - mmm that was nice. sometimes it's "ugh i guess i have to defer this now...."
it has its uses