From 9c6485b167a3b2afeb28d3eec98d350a63d6cc54 Mon Sep 17 00:00:00 2001 From: Junwei Zhao Date: Thu, 9 Jan 2020 14:22:00 +1100 Subject: [PATCH] Add an interesting code sample --- categories/go.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/categories/go.md b/categories/go.md index d2dbae0..222179c 100644 --- a/categories/go.md +++ b/categories/go.md @@ -358,9 +358,9 @@ func main() { } ``` -# commands +## commands -## test +### test - go test ./... -  run all tests in current directory and all of its subdirectories @@ -379,6 +379,23 @@ Wiki: * gore +# Some code snippets + +## defer would still run after panic + +```go +package main +func main() { + for { + defer func() { + for { + } + }() + panic("yolo") + } +} +``` + # Useful links * [Go best practice](https://github.com/golang/go/wiki/CodeReviewComments) * [Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments)