From 5f1a32384f197846f821ed48a8e8ec21ba212c57 Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Mon, 7 Oct 2019 19:50:09 +0800 Subject: [PATCH] Add the installation about ants v2 --- README.md | 10 +++++++++- README_ZH.md | 11 +++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9ad62cf..991160e 100644 --- a/README.md +++ b/README.md @@ -44,10 +44,18 @@ Library `ants` implements a goroutine pool with fixed capacity, managing and rec ## How to install -``` sh +### For `ants` v1 + +``` powershell go get -u github.com/panjf2000/ants ``` +### For `ants` v2 + +```powershell +go get -u github.com/panjf2000/ants/v2 +``` + ## How to use Just take a imagination that your program starts a massive number of goroutines, resulting in a huge consumption of memory. To mitigate that kind of situation, all you need to do is to import `ants` package and submit all your tasks to a default pool with fixed capacity, activated when package `ants` is imported: diff --git a/README_ZH.md b/README_ZH.md index 84b3520..3c853ca 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -42,13 +42,20 @@ A goroutine pool for Go ants

- ## 安装 -``` sh +### 使用 `ants` v1 版本: + +``` powershell go get -u github.com/panjf2000/ants ``` +### 使用 `ants` v2 版本: + +```powershell +go get -u github.com/panjf2000/ants/v2 +``` + ## 使用 写 go 并发程序的时候如果程序会启动大量的 goroutine ,势必会消耗大量的系统资源(内存,CPU),通过使用 `ants`,可以实例化一个协程池,复用 goroutine ,节省资源,提升性能: