timer包里,用函数值代替变参函数怎么样?
Abierto
- Lenguaje dominante
- Go
- Estrellas
- 7.8k
- Forks
- 1.3k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
感觉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")
})
}
```
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.