From 70d75d412525325c4ecd99a44d600543e5dd567c Mon Sep 17 00:00:00 2001 From: andreimarcu Date: Tue, 27 Oct 2015 00:01:28 -0400 Subject: [PATCH] No one saw that --- util.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 util.go diff --git a/util.go b/util.go new file mode 100644 index 0000000..10f40a7 --- /dev/null +++ b/util.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "os" +) + +func checkErr(err error) { + if err != nil { + fmt.Println(err) + os.Exit(1) + } +} + +func getInput(query string, allowBlank bool) (input string) { + for input == "" { + fmt.Print(query + ": ") + fmt.Scanf("%s\n", &input) + + if allowBlank { + break + } + } + + return +}