package wmenu

import (
	"os"
	"os/exec"
	"runtime"
)

var clear map[string]func()

func init() {
	clear = make(map[string]func())
	clear["linux"] = func() {
		cmd := exec.Command("clear")
		cmd.Stdout = os.Stdout
		cmd.Run()
	}
	clear["darwin"] = func() {
		cmd := exec.Command("clear")
		cmd.Stdout = os.Stdout
		cmd.Run()
	}
	clear["windows"] = func() {
		cmd := exec.Command("cmd", "/c", "cls")
		cmd.Stdout = os.Stdout
		cmd.Run()
	}
}

//Clear simply clears the command line interface (os.Stdout only).
func Clear() {
	value, ok := clear[runtime.GOOS]
	if ok {
		value()
	}
}

package wmenu

import (
	"os"
	"os/exec"
	"runtime"
)

var clear map[string]func()

func init() {
	clear = make(map[string]func())
	clear["linux"] = func() {
		cmd := exec.Command("clear")
		cmd.Stdout = os.Stdout
		cmd.Run()
	}
	clear["darwin"] = func() {
		cmd := exec.Command("clear")
		cmd.Stdout = os.Stdout
		cmd.Run()
	}
	clear["windows"] = func() {
		cmd := exec.Command("cls")
		cmd.Stdout = os.Stdout
		cmd.Run()
	}
}

//Clear simply clears the command line interface (os.Stdout only).
func Clear() {
	value, ok := clear[runtime.GOOS]
	if ok {
		value()
	}
}

--- 
+++ 
@@ -21,7 +21,7 @@
 		cmd.Run()
 	}
 	clear["windows"] = func() {
-		cmd := exec.Command("cls")
+		cmd := exec.Command("cmd", "/c", "cls")
 		cmd.Stdout = os.Stdout
 		cmd.Run()
 	}
Fix clear screen function on windows

See http://stackoverflow.com/questions/19209425/how-can-i-clear-the-console-with-golang-in-windows#comment29035981_19290028 for more information on why this is needed