项目地址:[https://github.com/chenhg5/go-task](https://github.com/chenhg5/go-task)
安装
```
go get github.com/chenhg5/go-task
```
使用
```
import (
"runtime"
"fmt"
"time"
"github.com/chenhg5/go-task"
)
func main() {
// init
task.InitTaskReceiver(runtime.NumCPU())
// add task
task.AddTask(task.NewTask(
map[string]interface{}{
"paramA" : "value",
}, // parameter
[]task.FacFunc{func(uuid string, param map[string]interface{}) (string, error) {
fmt.Println(uuid)
fmt.Println(param)
return "ok", nil
}}),
)
time.Sleep(time.Second * 5)
}
```
有疑问加站长微信联系(非本文作者))