This is going to be a simple question to answer, I am sure of it. I am brand new to Go and I can't figure out what is happening.
package main
import (
"fmt"
"bufio"
"os"
"strings"
)
func main() {
fmt.Print("*A basic GoLang/Native example*
")
fmt.Print("Enter your name:
")
reader := bufio.NewReader(os.Stdin)
name, _ := reader.ReadString('
')
name = strings.TrimSuffix(name, "
")
fmt.Printf("Hello, %s, how are you?", name)
reader.ReadString('
')
}
I am removing the newline which is stored in variable name from reading in the user input, but the last Printf statement is truncating Hello, from the line.