Skip to content

Instantly share code, notes, and snippets.

@jheth
Created June 24, 2021 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jheth/a8766807e5f1b402296b25961d687f61 to your computer and use it in GitHub Desktop.
Save jheth/a8766807e5f1b402296b25961d687f61 to your computer and use it in GitHub Desktop.
golang input prompt
reader := bufio.NewReader(os.Stdin)
fmt.Print("Skip? ")
text, _ := reader.ReadString('\n')
fmt.Println(text)
if strings.HasPrefix(strings.ToLower(text), "y") {
continue
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment