Skip to content

Commit d92c0b0

Browse files
committed
更新使用示例文档
1 parent a7a9a01 commit d92c0b0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

taskgroup_example_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package taskgroup_test
22

33
import (
44
"fmt"
5+
"time"
56

67
"github.com/mlee-msl/taskgroup"
78
)
@@ -12,6 +13,13 @@ import (
1213

1314
// Typical 展示了典型的使用案例,包括,多任务创建、任务执行、结果收集,错误处理等
1415
func ExampleTaskGroup_typical() {
16+
defer func() func() {
17+
start := time.Now()
18+
return func() {
19+
_ = fmt.Sprintf("elapsed: %d", time.Since(start))
20+
}
21+
}()()
22+
1523
type TaskType = uint32
1624
const (
1725
_ TaskType = iota

0 commit comments

Comments
 (0)