use sync.WaitGroup for waiting output goroutine