Skip to content

Instantly share code, notes, and snippets.

@jeffotoni
Created July 13, 2017 21:09
Show Gist options
  • Select an option

  • Save jeffotoni/7d31f976569b5d1dfd7f7f2ee0810639 to your computer and use it in GitHub Desktop.

Select an option

Save jeffotoni/7d31f976569b5d1dfd7f7f2ee0810639 to your computer and use it in GitHub Desktop.
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {
reader := bufio.NewReader(os.Stdin)
// Prompt and read
fmt.Print("Nome: ")
text, _ := reader.ReadString('\n')
fmt.Print("Namorada: ")
text2, _ := reader.ReadString('\n')
// Trim whitespace and print
fmt.Printf("Nome: \"%s\", Namorada \"%s\"\n",
strings.TrimSpace(text), strings.TrimSpace(text2))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment