1
0
mirror of https://github.com/rancher/os.git synced 2025-09-02 15:24:32 +00:00

Use of bufio instead of fmt.Scan for yes function

This commit is contained in:
Julien Kassar
2017-02-17 03:20:04 -05:00
parent db5da1ebfe
commit 14257bdde8

View File

@@ -1,7 +1,9 @@
package control
import (
"bufio"
"fmt"
"os"
"strings"
"github.com/rancher/os/log"
@@ -9,8 +11,8 @@ import (
func yes(question string) bool {
fmt.Printf("%s [y/N]: ", question)
var line string
_, err := fmt.Scan(&line)
in := bufio.NewReader(os.Stdin)
line, err := in.ReadString('\n')
if err != nil {
log.Fatal(err)
}