package main import ( "fmt" "github.com/AlecAivazis/survey" ) // the questions to ask var simpleQs = []*survey.Question{ { Name: "name", Prompt: &survey.Input{ Message: "What is your name?", }, Validate: survey.Required, }, { Name: "color", Prompt: &survey.Select{ Message: "Choose a color:", Options: []string{"red", "blue", "green"}, }, Validate: survey.Required, }, } func main() { ansmap := make(map[string]string) // ask the question err := survey.Ask(simpleQs, &ansmap) if err != nil { fmt.Println(err.Error()) return } // print the answers fmt.Printf("%s chose %s.\n", ansmap["name"], ansmap["color"]) }