SaveSnippets
Community
Pricing
Sign In
Get Started
Community
Public Snippets
1
Code shared by the SaveSnippets community — browse, copy, and get inspired.
All Languages
Bash
Go
HTML
Java
JavaScript
Kotlin
PHP
Python
Rust
SQL
TypeScript
#defer
Clear
Tags
#php
#kotlin
#bash
#go
#sql
#rust
#typescript
#html
#java
#python
#files
#utils
#strings
#http
#concurrency
#async
#json
#arrays
#security
#types
#crypto
#database
#dates
#format
Go
defer / panic / recover
`defer` runs a statement when the enclosing function returns — LIFO order. `panic` aborts; `recover` (inside a deferred func) catches a panic and converts it back to a normal return. Use sparingly.
#go
#basics
#defer
#panic
#recover