Command Line User Input in Golang

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today!

Cheatsheet reference for handling command line user input in Golang:

// Command Line User Input in Golang
package main
import (
func main() {
reader := bufio.NewReader(os.Stdin)
fmt.Print(">>> ")
userInput, _ := reader.ReadString('\n')
fmt.Print(">>> ")
userInput2, _ := reader.ReadString('\n')
fmt.Print(">>> ")
userInput3, _ := reader.ReadString('\n')
view raw userinput.go hosted with ❤ by GitHub