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*\n\n")
fmt.Print("Enter your name:\n")
reader := bufio.NewReader(os.Stdin)
name, _ := reader.ReadString('\n')
name = strings.TrimSuffix(name, "\n")
fmt.Printf("Hello, %s, how are you?", name)
reader.ReadString('\n')
}
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.