mirror of
https://github.com/rancher/os.git
synced 2025-09-03 07:44:21 +00:00
Use of bufio instead of fmt.Scan for yes function
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
package control
|
package control
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/rancher/os/log"
|
"github.com/rancher/os/log"
|
||||||
@@ -9,8 +11,8 @@ import (
|
|||||||
|
|
||||||
func yes(question string) bool {
|
func yes(question string) bool {
|
||||||
fmt.Printf("%s [y/N]: ", question)
|
fmt.Printf("%s [y/N]: ", question)
|
||||||
var line string
|
in := bufio.NewReader(os.Stdin)
|
||||||
_, err := fmt.Scan(&line)
|
line, err := in.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user