From 9b4b8bd1910787b4380404ac7315ae65763dcac7 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Mon, 8 Jan 2018 15:29:24 +0100 Subject: Swicth to \n as EOL --- console.go | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'console.go') diff --git a/console.go b/console.go index 69082ae..5c63fbb 100644 --- a/console.go +++ b/console.go @@ -6,28 +6,10 @@ import ( ) type Console struct { - r io.Reader - w io.Writer + io.Reader + io.Writer } func NewConsole() *Console { - return &Console{ - r: os.Stdin, - w: os.Stdout, - } -} - -func (c *Console) Read(p []byte) (int, error) { - n, err := c.r.Read(p) - for i, v := range p { - // replace nl with cr - if v == 10 { - p[i] = 13 - } - } - return n, err -} - -func (c *Console) Write(p []byte) (int, error) { - return c.w.Write(p) + return &Console{Reader: os.Stdin, Writer: os.Stdout} } -- cgit v1.2.3