Skip to content

Instantly share code, notes, and snippets.

@ph
Created September 27, 2018 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ph/f532130e14631e5e023da12fa7ef1e24 to your computer and use it in GitHub Desktop.
Save ph/f532130e14631e5e023da12fa7ef1e24 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"sync"
"time"
)
type OK struct{}
func main() {
ch := make(chan *OK)
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
for {
select {
case v := <-ch:
fmt.Println(v)
time.Sleep(1 * time.Second)
}
}
}()
ch <- &OK{}
close(ch)
wg.Wait()
fmt.Println("vim-go")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment