package main
import (
"fmt"
"time"
)
func main() {
c := make(chan struct{}, 1)
go func() {
fmt.Println(time.Now().Format("2006-01-02 15:04:05"))
time.Sleep(time.Second * 5)
close(c)
// c <- struct{}{}
}()
// 等待 goroutine
<-c
fmt.Println(time.Now().Format("2006-01-02 15:04:05"))
}