diff --git a/README.md b/README.md index 255096d..7f9f653 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ type Request struct { } func main() { - pool, _ := ants.NewPoolWithFunc(100000, func(payload interface{}) { + pool, _ := ants.NewPoolWithFunc(100000, func(payload interface{}) { request, ok := payload.(*Request) if !ok { return @@ -152,7 +152,7 @@ func main() { }(request.Param) request.Result <- reverseParam - }) + }) defer pool.Release() http.HandleFunc("/reverse", func(w http.ResponseWriter, r *http.Request) { diff --git a/README_ZH.md b/README_ZH.md index f8fc2d9..31b1e61 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -139,7 +139,7 @@ type Request struct { } func main() { - pool, _ := ants.NewPoolWithFunc(100000, func(payload interface{}) { + pool, _ := ants.NewPoolWithFunc(100000, func(payload interface{}) { request, ok := payload.(*Request) if !ok { return @@ -152,7 +152,7 @@ func main() { }(request.Param) request.Result <- reverseParam - }) + }) defer pool.Release() http.HandleFunc("/reverse", func(w http.ResponseWriter, r *http.Request) {