From f1123afa1f3c351d1fa144a35320213179c789e1 Mon Sep 17 00:00:00 2001 From: Adrian Gallagher Date: Mon, 19 Feb 2018 10:19:27 +1100 Subject: [PATCH] Use fmt.Scanln for exchange templating tool --- tools/exchange_template/exchange_template.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tools/exchange_template/exchange_template.go b/tools/exchange_template/exchange_template.go index 674995a4..ac5baa13 100644 --- a/tools/exchange_template/exchange_template.go +++ b/tools/exchange_template/exchange_template.go @@ -1,7 +1,6 @@ package main import ( - "bufio" "flag" "fmt" "html/template" @@ -70,15 +69,15 @@ func main() { fmt.Println("REST Supported: ", restSupport) fmt.Println("FIX Supported: ", fixSupport) fmt.Println() - fmt.Println("Please check if everything is correct then press enter to continue...") + fmt.Println("Please check if everything is correct and then type y to continue or n to cancel...") - reader := bufio.NewReader(os.Stdin) - choice, _, err := reader.ReadRune() + var choice []byte + _, err := fmt.Scanln(&choice) if err != nil { - log.Fatal("GoCryptoTrader: Exchange templating tool bufio.reader error ", err) + log.Fatal("GoCryptoTrader: Exchange templating tool fmt.Scanln ", err) } - if choice != '\n' { + if !common.YesOrNo(string(choice)) { log.Fatal("GoCryptoTrader: Exchange templating tool stopped...") }