aceld / aceld/zinx

timer包里,用函数值代替变参函数怎么样?

Open
#50 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
7.8k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

感觉delayfunc哪里用函数值实现可能更好
让调用者自己生成一个匿名函数,匿名函数里调用自己想调用的函数
用变参有点不灵活
```go
type Callable func()

func docall(c Callable){
c()
}

func Sayhello(s string) {
fmt.Println(s)
}

func TestF(t *testing.T) {
docall(func() {
Sayhello("nihao")
})
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.