20 lines
274 B
Go
20 lines
274 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
)
|
|
|
|
func handleInput() <-chan byte {
|
|
ch := make(chan byte)
|
|
|
|
go func(ch chan byte) {
|
|
data := make([]byte, 1)
|
|
for _, err := os.Stdin.Read(data); err == nil; _, err = os.Stdin.Read(data) {
|
|
ch <- data[0]
|
|
}
|
|
close(ch)
|
|
}(ch)
|
|
|
|
return ch
|
|
}
|