Skip to content

Instantly share code, notes, and snippets.

@radar
Last active August 29, 2015 14:07
Show Gist options
  • Save radar/277a137ef394f04434ee to your computer and use it in GitHub Desktop.
Save radar/277a137ef394f04434ee to your computer and use it in GitHub Desktop.

Go CLI tools

Vanilla Go CLI Example

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	fmt.Print("What is your favourite color?: ")
	color, _ := reader.ReadString('\n')
	fmt.Println("My favourite color is", strings.Replace(color, "\n", "", 1), "too!")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment