From be815901ff609819d20447cabd61e09f78c85f18 Mon Sep 17 00:00:00 2001 From: Lukas Malkmus Date: Mon, 2 Jan 2017 19:54:44 +0100 Subject: [PATCH 1/3] Use term.Write() to write to console --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index c68af76..78aeb40 100644 --- a/main.go +++ b/main.go @@ -61,7 +61,7 @@ func main() { fmt.Println("Error: " + err.Error()) continue } - fmt.Printf("%s\n", strconv.FormatFloat(res, 'G', -1, 64)) + term.Write([]byte(fmt.Sprintf("%s\n", strconv.FormatFloat(res, 'G', -1, 64)))) } } From f3b7c5ea9b09431b5269fb1454715b9b79d10d43 Mon Sep 17 00:00:00 2001 From: Lukas Malkmus Date: Mon, 2 Jan 2017 19:54:44 +0100 Subject: [PATCH 2/3] Use term.Write() to write to console --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index c68af76..48ba0dd 100644 --- a/main.go +++ b/main.go @@ -58,10 +58,10 @@ func main() { res, err := compute.Evaluate(text) if err != nil { - fmt.Println("Error: " + err.Error()) + term.Write([]byte(fmt.Sprintln("Error: " + err.Error()))) continue } - fmt.Printf("%s\n", strconv.FormatFloat(res, 'G', -1, 64)) + term.Write([]byte(fmt.Sprintf("%s\n", strconv.FormatFloat(res, 'G', -1, 64)))) } } From c15f3504f2d953611bbb0e4362eb62283618f9a0 Mon Sep 17 00:00:00 2001 From: Lukas Malkmus Date: Mon, 2 Jan 2017 22:42:04 +0100 Subject: [PATCH 3/3] Drop Sprintf in favor of Sprintln --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 48ba0dd..2e9604f 100644 --- a/main.go +++ b/main.go @@ -61,7 +61,7 @@ func main() { term.Write([]byte(fmt.Sprintln("Error: " + err.Error()))) continue } - term.Write([]byte(fmt.Sprintf("%s\n", strconv.FormatFloat(res, 'G', -1, 64)))) + term.Write([]byte(fmt.Sprintln(strconv.FormatFloat(res, 'G', -1, 64)))) } }