diff --git a/README.md b/README.md index 2f3786e..38f287b 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ type Request struct { func main() { pool, _ := ants.NewPoolWithFunc(100, func(payload interface{}) { - request, ok := payload.(Request) + request, ok := payload.(*Request) if !ok { request = Request{Param:[]byte(""), Result: make(chan []byte)} } @@ -141,7 +141,7 @@ func main() { } defer r.Body.Close() - request := Request{Param: param, Result: make(chan []byte)} + request := &Request{Param: param, Result: make(chan []byte)} // Throttle the requests with ants pool. This process is asynchronous and // you can receive a result from the channel defined outside. diff --git a/README_ZH.md b/README_ZH.md index 871dd34..c3ffa88 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -118,7 +118,7 @@ type Request struct { func main() { pool, _ := ants.NewPoolWithFunc(100, func(payload interface{}) { - request, ok := payload.(Request) + request, ok := payload.(*Request) if !ok { request = Request{Param:[]byte(""), Result: make(chan []byte)} } @@ -140,7 +140,7 @@ func main() { } defer r.Body.Close() - request := Request{Param: param, Result: make(chan []byte)} + request := &Request{Param: param, Result: make(chan []byte)} // Throttle the requests with ants pool. This process is asynchronous and // you can receive a result from the channel defined outside.