gitee.com/sy_183/go-common@v1.0.5-0.20231205030221-958cfe129b47/lifecycle.v2/task/task_test.go (about) 1 package task 2 3 import ( 4 "fmt" 5 "testing" 6 ) 7 8 func TestChan(t *testing.T) { 9 ch := make(chan struct{}, 2) 10 ch <- struct{}{} 11 close(ch) 12 fmt.Printf("len: %d, cap: %d\n", len(ch), cap(ch)) 13 }