Can anybody see why this switch won't work?
func main() {
reader := bufio.NewReader(os.Stdin)
text, _ := reader.ReadString('
')
fmt.Print(text)
switch text {
case "a":
fmt.Print("A
")
case "b":
fmt.Print("B
")
case "c":
fmt.Print("C
")
default:
fmt.Print("DEFAULT
")
}
}
In this statement, the default value is always returned yet when hard coding the switch expression, the switch block works as it should. Looking at the ReadString() func code, it returns a string so I can't see any reason for my example to not work.
Am I doing something wrong?!