mirror of
https://github.com/wahyd4/knowledge.git
synced 2026-08-08 20:57:48 +10:00
Add an interesting code sample
This commit is contained in:
+19
-2
@@ -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: <https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop>
|
||||
|
||||
* gore <https://github.com/motemen/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)
|
||||
|
||||
Reference in New Issue
Block a user