Files
migrate-github/utils/readLine.go
2018-06-07 22:50:47 +03:00

22 lines
315 B
Go

package utils
import (
"bufio"
"os"
"strings"
)
var rd *bufio.Reader
// ReadLine reads a line from stdin and strips newline from the end
func ReadLine() string {
if rd == nil {
rd = bufio.NewReader(os.Stdin)
}
str, err := rd.ReadString('\n')
PanicOnError(err)
return strings.TrimRight(str, "\r\n")
}